RowSpan Table Property

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF CoreSuite for .NET (v5)  /  Re: RowSpan Table Property

DynamicPDF CoreSuite for .NET (v5) Forum

 Apr 06 2009 2:39 PM
I am attempting to create a table using the rowspan property, but the last row vanishes whenever I set rowspan.

I need the table to look like this:
 ______
|  |_|_|
|  |_|_|
|__|_|_|
|__|_|_|

I keep getting this:
 ______
|  |_|_|
|  |_|_|
|__|_|_|

The fourth row won't show up. I'm not sure what I'm doing wrong, and can't find any documentation on how to use the rowspan property.

Here is the code: (width and height are set prior to this)
---------------------------------------------------
Table titleBlock = new Table(0, 0, width, height);

            titleBlock.Columns.Add((float)(width * 0.30));
            titleBlock.Columns.Add((float)(width * 0.19));
            titleBlock.Columns.Add((float)(width * 0.51));

            Row row1 = titleBlock.Rows.Add((float)(height * 0.25), Font.HelveticaBold, 16, Grayscale.Black, Grayscale.White);
            //row1.Align = CellAlign.Center;
            //row1.VAlign = CellVAlign.Center;
            row1.Cells.Add("A1", Font.HelveticaBold, 6, 1, 3);
            row1.Cells.Add(" B1 ", 1, 1);
            row1.Cells.Add(" C1 ", 1, 1);

            Row row2 = titleBlock.Rows.Add((float)(height * 0.25), Font.HelveticaBold, 16, Grayscale.Black, Grayscale.White);
            //row2.Align = CellAlign.Center;
            //row2.VAlign = CellVAlign.Center;
            row2.Cells.Add("B2 ", 1, 1);
            row2.Cells.Add(" C2 ", 1, 1);

            Row row3 = titleBlock.Rows.Add((float)(height * 0.25), Font.HelveticaBold, 16, Grayscale.Black, Grayscale.White);
            //row3.Align = CellAlign.Center;
            //row3.VAlign = CellVAlign.Center;
            row3.Cells.Add(" B3 ", 1, 1);
            row3.Cells.Add(" C3", 1, 1);

            Row row4 = titleBlock.Rows.Add((float)(height * 0.25), Font.HelveticaBold, 16, Grayscale.Black, Grayscale.White);
            //row4.Align = CellAlign.Center;
            //row4.VAlign = CellVAlign.Center;
            row4.Cells.Add(" A4 ", 1, 1);
            row4.Cells.Add(" B4 ", 1, 1);
            row4.Cells.Add(" D4 ", 1, 1);
---------------------------------------------------

If I change the rowspan of the first cell to 4 instead of 3, and remove the "A4" cell, the fourth row will display. Is this a bug, or something I'm doing incorrectly? Is there any detailed documentation on how to use the "rowspan" property?

Thanks!
 Apr 06 2009 3:03 PM
Posted by a ceTe Software moderator
Hello,

I tested the following code and the fourth row showed up fine. The likely reason you do not see the fourth row is becasue the table height may be incorrect.

            Document document = new Document();
            Page page = new Page();

            Table titleBlock = new Table(0, 0, 100, 300);

            titleBlock.Columns.Add(30);
            titleBlock.Columns.Add(30);
            titleBlock.Columns.Add(30);

            Row row1 = titleBlock.Rows.Add(20, Font.HelveticaBold, 16, Grayscale.Black, Grayscale.White);
            row1.Cells.Add("A1", Font.HelveticaBold, 6, 1, 3);
            row1.Cells.Add(" B1 ", 1, 1);
            row1.Cells.Add(" C1 ", 1, 1);

            Row row2 = titleBlock.Rows.Add(20, Font.HelveticaBold, 16, Grayscale.Black, Grayscale.White);
            row2.Cells.Add("B2 ", 1, 1);
            row2.Cells.Add(" C2 ", 1, 1);

            Row row3 = titleBlock.Rows.Add(20, Font.HelveticaBold, 16, Grayscale.Black, Grayscale.White);
            row3.Cells.Add(" B3 ", 1, 1);
            row3.Cells.Add(" C3", 1, 1);

            Row row4 = titleBlock.Rows.Add(20, Font.HelveticaBold, 16, Grayscale.Black, Grayscale.White);
            row4.Cells.Add(" A4 ", 1, 1);
            row4.Cells.Add(" B4 ", 1, 1);
            row4.Cells.Add(" D4 ", 1, 1);

            page.Elements.Add(titleBlock);
            document.Pages.Add(page);

Thanks,
ceTe Software Support Team

All times are US Eastern Standard time. The time now is 3:35 AM.