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

Free Support Forum - aspose.com

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:

http://www.aspose.com/documentation/.net-components/aspose.words-for-.net/howto-autofit-a-table-to-page-width.html

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:

http://www.aspose.com/documentation/.net-components/aspose.words-for-.net/aspose.words.tables.table.leftindent.html

After specifying the left indent, you should fit the table to window.

http://www.aspose.com/documentation/.net-components/aspose.words-for-.net/aspose.words.tables.table.autofit.html

Hope this helps.

Best regards,