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

Free Support Forum - aspose.com

Adding a horizontal line and text to cell

Hi there,

I need to add a Shape.Line and some text beneath it to a table cell in footer.
Any idea how I might achieve this?

I am using the builder to build the table.
My test code so far is:

builder.startTable();
Cell cell = builder.insertCell();
builder.getParagraphFormat().setAlignment(ParagraphAlignment.CENTER);
builder.getCellFormat().getBorders().clearFormatting();
builder.getCellFormat().setTopPadding(50);
builder.getCellFormat().setVerticalAlignment(ParagraphAlignment.CENTER);

Shape shape = new Shape(doc, ShapeType.LINE);
shape.setWidth(200);
shape.setTop(35);
shape.setHorizontalAlignment(HorizontalAlignment.CENTER);
shape.setVerticalAlignment(VerticalAlignment.CENTER);

com.aspose.words.Paragraph para = cell.getFirstParagraph();
para.appendChild(shape);

builder.writeln(“SOME TEXT”);
builder.write(“OTHER TEXT”);



I also tried to do it as it’s described in this
Sadly it didn’t work.

Any help is appreciated!

Hi Lucian,


Thanks for your inquiry. Could you please attach your input Word document, expected document, and complete source code you’re using on your end here for our reference. We will investigate the structure of your expected document as to how you want your final output be generated like. You can create expected document using Microsoft Word. We will then provide you code to achieve the same using Aspose.Words.

Best regards,