We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Creating a Line and aligning vertically

Hi Team,

I want to add a Line in an excel and align the line vertically.
I tried with the following code :

Shape shape0 = shapes.addShape(ShapeType.Line, 9, 0, 40, 0, 100, 200);

Line is getting created but the alignment is not coming vertically.

Please find the attached screenshot of the Line shape created.

Could you please help me on how to align the line vertically.


Hi Sanjeev,

Thank you for contacting Aspose support.

Please check the following piece of code that creates a vertical line shape.


Workbook workbook = new Workbook();
Worksheet worksheet = workbook.getWorksheets().get(0);
ShapeCollection shapes = worksheet.getShapes();
shapes.addShape(MsoDrawingType.LINE, 5, 0, 1, 0, 250, 0);
workbook.save(dir + “output.xlsx”);

Hi Babar Raza,

Thanks for the code snippet!
Its working fine now.


Hi Sanjeev,

Thank you for the confirmation. Please feel free to contact us back in case you need our further assistance with Aspose APIs.