Table Format

Hello Aspose,

I’m trying to format tables.
I order a table inside of a cell of outer table.
The inner table has 2 columns. The first column must have fixed size to avoid line breaks. The following column can have flexible size to fit into outer table cell.
The number of cells of the outer table might grow during build up time. So the size of the second inner column will shrink.
What I need is a kind of Table.ColumnWidths = “20 *”. Does that exist?

My problem would be also solved, if I could read the size of the outer cell at table creation time.
I’m using aspose.pdf 9.6.0.

regards
Gerd

Hi Gerd,


Thanks for using our API.

As per my understanding, you need to calculate the width of second column of outer table (main table which contains nested/inner table). Please share the code snippet and some sample PDF / image file which can better help us in understanding the requirement.

I try to explain it with a very simple example. My reality is more complex.

The first column is build of text and an image in another inner table.
The text is wrapped automatically, thanks for that, in the first cell.
The size of the first column is fixed due to the image in the second cell which is not allowed to be shrinked.

The second column is fixed size due to image which is again not allowed to be shrinked.

The third column is variable, because it contains text only.

To calculate the latest column width I must step through all the content of the nested tables, look for images (and their sizes) and do the necessary settings on basis of the page width.

So my hope was for a simpler solution like:

Table.ColumnAdjustment = ColumnAdjustmentType.AutoFitToWindow;

Table.ColumnWidths = InnerTable.Width +" " + Image.Width + " *".

Thanks for good ideas.
Regards
Gerd

PS: In your example in http://www.aspose.com/docs/display/pdfnet/Placing+a+text+around+an+image you know the sizes of the columns.

Hi Gerd,


Thanks for sharing the details.

By using ColumnWidths property of Aspose.Pdf.Table class, you can specify the fixed width for columns of the table. Are you still facing an issue while setting the width for table columns? If so is the case, then please share the code snippet and resultant file generating at your end, so that we can test the scenario in our environment.