Table in Table?

Hello,

Is it possible to insert a Table inside an other Table with Aspose Words for Java ?

Thanks.

Cyril.

Hello

Thanks for your interest in Aspose.Words for Java. Yes of course, you can do it with Aspose.Words, try using DocumentBuilder to achieve what you need. Please see the following link:
https://docs.aspose.com/words/net/document-builder-overview/
Please let me know in case of any issues. I will be glad to help you.
Best regards,

Hello,

Do you have a short sample in Java for inserting a table in a table?

Thanks.

Cyril

Hello

Thanks for your inquiry. Please see the following code:

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.startTable();
// Insert a cell
builder.insertCell();
builder.getCellFormat().setVerticalAlignment(CellVerticalAlignment.CENTER);
builder.writeln("This is row 1 cell 1 table 1");
// Insert Table 2
builder.startTable();
// Insert a cell
builder.insertCell();
builder.getCellFormat().setVerticalAlignment(CellVerticalAlignment.CENTER);
builder.writeln("This is table 2");
// Insert a cell
builder.insertCell();
builder.writeln("This is table 2");
builder.endRow();
// Apply new row formatting
builder.getRowFormat().setHeight(100);
builder.getRowFormat().setHeightRule(HeightRule.EXACTLY);
// Insert a cell
builder.insertCell();
builder.getCellFormat().setOrientation(TextOrientation.UPWARD);
builder.writeln("This is table 2");
// Insert a cell
builder.insertCell();
builder.getCellFormat().setOrientation(TextOrientation.DOWNWARD);
builder.writeln("This is table 2");
builder.endRow();
builder.endTable();
// Insert a cell
builder.insertCell();
builder.writeln("This is row 1 cell 2 table 1");
builder.endRow();
// Apply new row formatting
builder.getRowFormat().setHeight(100);
builder.getRowFormat().setHeightRule(HeightRule.EXACTLY);
// Insert a cell
builder.insertCell();
builder.getCellFormat().setOrientation(TextOrientation.UPWARD);
builder.writeln("This is row 2 cell 1 table 1");
// Insert a cell
builder.insertCell();
builder.getCellFormat().setOrientation(TextOrientation.DOWNWARD);
builder.writeln("This is row 2 cell 2 table 1");
builder.endRow();
builder.endTable();
doc.save("C:\\Temp\\out.doc");

Best regards,