How to set/get table width :

Hi ,

I am using aspose words for document conversion . I need to set/get table width . Following code does no change in output

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.getCellFormat().getBorders().setLineStyle(LineStyle.SINGLE);
builder.getCellFormat().getBorders().setColor(Color.RED);
builder.getCellFormat().setWidth(3 * 72);
builder.insertCell();
builder.write("test");
builder.endRow();
builder.insertCell();
builder.write("test");
builder.endRow();
builder.endTable();
doc.save("Tablee.doc");

Am i doing anything wrong ? But after using ’ builder.getCellFormat().setPreferredWidth(PreferredWidth.fromPoints(2 * 72)); ’ i can able to set table width as expected . Whats the correct method to set table width ?

Thanks,
Anbu

Hi
Thanks for your request. If you would like to set width of the whole table, then you should use Table.PreferredWidth property. Please see the following link for more information:
https://reference.aspose.com/words/net/aspose.words.tables/table/preferredwidth/
Please let us know if you need more information, we are always glad to help you.
Best regards,