Stuck while creating dynamic table

Hi,

I’m creating a table with dynamic number of rows and columns. I’m facing issue with left indent of the table. I’m indenting my table by half an inch on the left side and because of this it goes out of the page margins on the right side. Is there a way to set the width of the table in such a way that all the columns in the table have equal width and I can set the width of the table?

Thanks

Hello
Thanks for your request. I think in this case you can try using the following code:

// Open document
Document doc = new Document("C:\\Temp\\in.doc");
foreach(Table table in doc.GetChildNodes(NodeType.Table, true))
{
    FitTableToPageWidth(table);
}
doc.Save("C:\\Temp\\out.pdf");

FitTableToPageWidth class you can find here:
https://docs.aspose.com/words/net/working-with-tables/
Best regards,

The issues you have found earlier (filed as WORDSNET-352) have been fixed in this .NET update and in this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(86)

Hi,

I’m not really sure how to use this new API, there are options to fit the table to the page but what I want is to have left indent of half inch and then the table should start and take up the rest of the space available. If you guys can provide a sample that would be great.

Thanks.

Hi
Thanks for your request. I think, in your case it would be enough simply specify left indent of your table. Please see Left indent property:
https://reference.aspose.com/words/net/aspose.words.tables/table/leftindent/
After specifying the left indent, you should fit the table to window.
https://reference.aspose.com/words/net/aspose.words.tables/table/autofit/
Hope this helps.
Best regards,