Skip to content

Instantly share code, notes, and snippets.

@aspose-com-kb
Last active February 16, 2024 19:23
Show Gist options
  • Save aspose-com-kb/c048c322a94a484b07cb318ab8fc0803 to your computer and use it in GitHub Desktop.
Save aspose-com-kb/c048c322a94a484b07cb318ab8fc0803 to your computer and use it in GitHub Desktop.
Draw Line in Excel using Java. For more details: https://kb.aspose.com/cells/java/draw-line-in-excel-using-java/
import com.aspose.cells.*;
public class Main
{
public static void main(String[] args) throws Exception // Draw lines using Java
{
// Set the licenses
new License().setLicense("License.lic");
// Create a workbook
Workbook book = new Workbook();
// Select a sheet
Worksheet worksheet = book.getWorksheets().get(0);
// Draw line
ShapeCollection shapes = worksheet.getShapes();
shapes.addLine(3, 5, 3, 5, 100, 500);
// Save the output
book.save("sample.xlsx", SaveFormat.XLSX);
System.out.println("Done");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment