Tables within floating boxes only displaying first column in Aspose 7.7- works in Aspose 6.1

Greetings.


Some example code:

Pdf pdf = new Pdf();
Section section = pdf.Sections.Add();

FloatingBox fb = new FloatingBox();
fb.Top = 10.0f;
fb.Left = 10.0f;

section.Paragraphs.Add(fb);

Table tbl = new Table();
Row tblRow = tbl.Rows.Add();
Cell col1 = tblRow.Cells.Add(“test1”), col2 = tblRow.Cells.Add(“test2”), col3 = tblRow.Cells.Add(“test3”);

fb.Paragraphs.Add(tbl);

pdf.Save(…); //you get the idea

Anyway, with code similar to this, it renders the floating box and table at the proper positions and displays fields correctly under Aspose 6.1. After switching to 7.7.0 however, only the first column is rendered. Anything placed right of the first column is not rendered. For example, creating a second table, placing it into the floating box oriented to the right of the first table results in that table not being rendered at all.

I would hate to have to revert to the older library version just to properly position tables within floating boxes, but unless someone knows what is going on, that is likely what I’m going to have to do. Any information that can be provided would be appreciated.

Thanks.


Hi Micah,

Thanks for your inquiry. Please set column widths of table after instantiating table object. Please check following code snippet for the details and documentation link Create or Add Table In PDF using C#
for complete details about table generation.

Pdf pdf = new Pdf();
Section section = pdf.Sections.Add();

FloatingBox fb = new FloatingBox();
fb.Top = 10.0f;
fb.Left = 10.0f;

section.Paragraphs.Add(fb);

Aspose.Pdf.Generator.Table tbl = new Aspose.Pdf.Generator.Table();
tbl.ColumnWidths = (“40 40 40”);

Aspose.Pdf.Generator.Row tblRow = tbl.Rows.Add();
Aspose.Pdf.Generator.Cell col1 = tblRow.Cells.Add(“test1”), col2 = tblRow.Cells.Add(“test2”), col3 = tblRow.Cells.Add(“test3”);
fb.Paragraphs.Add(tbl);

pdf.Save(myDir + “floatingbox.pdf”);

Please feel free to contact us for any further assistance.

Best Regards,

Thank you for your reply.


This fixed the problem, thank you. It would appear that in older versions you did not have to explicitly define column widths, but in later versions you do. Odd.

Thanks.

Hi Micah,


I am pleased to know that your problem is resolved by specifying the columns width information using ColumnWidths property.

Please note that the proper approach for adding table inside PDF file is to specify columns width information and I also wonder how it worked in earlier version :). But since it’s a mandatory that a table containing more than one columns, should have columns width information and that’s how the latest release version is behaving. In the event of any further query, please feel free to contact.

PS, I think the issue related to rendering of tables without columns width might have been fixed in recent release versions.