Nested tables not accounting for colspan?


Folks -

Ran into a snag last week when I tried to nested tables using colspan attribute.

After thinking about it, I returned to the aspose example and tried to use its format to replicate the bug.

I added a nested table below the comment //My stuff.

Is there a way to get the nested table to recognize its true cell width?

Here is the code.

public void test()
{

Section sec1 = pdf1.Sections.Add();
Table tab1 = new Table();
sec1.Paragraphs.Add(tab1);
tab1.ColumnWidths = “50% 50%”;
tab1.DefaultCellBorder = new BorderInfo((int)BorderSide.All);

Row row1 = tab1.Rows.Add();
row1.Cells.Add(“left cell”);

Cell cell2 = row1.Cells.Add();

Table tab2 = new Table(cell2);
cell2.Paragraphs.Add(tab2);

tab2.ColumnWidths = “50% 50%”;


Row row21 = tab2.Rows.Add();
Cell cell21 = row21.Cells.Add(“top cell”);
cell21.ColumnsSpan = 2;

Row row22 = tab2.Rows.Add();
row22.Cells.Add(“left bottom cell”);
row22.Cells.Add(“right bottom cell”);

// My Stuff
Row row3 = tab1.Rows.Add();
Cell cell3 = row3.Cells.Add();
cell3.ColumnsSpan = 2;

Table tab3 = new Table();

cell3.Paragraphs.Add(tab3);
tab3.ColumnWidths = “50% 50%”;

Row row33 = tab3.Rows.Add();
row33.Cells.Add(“my left bottom cellddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd”);
row33.Cells.Add(“my right bottom celldddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd”);

}

The code above will create a nested table, but fails to get its width correctly. The outer table
has been defined as having two columns. So when we write to a new row, with a new cell
with the column width of the cell being two, then the nested table should obey the width argument
and create a new table of 100% instead of the 50% which a single cell has.




Hello John,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for considering Aspose.

Can you please elaborate your requirement little more for our understanding. It would be more convenient for us if you could describe little more about your desired output.

Hi,

I tested your code with Aspose.Pdf 3.7 and the result seems to be correct. See attachment. If it is not correct, please elaborate the problem or provide a Word document to illustrate what you want.