Table Borders

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF CoreSuite for .NET (v6)  /  Re: Table Borders

DynamicPDF CoreSuite for .NET (v6) Forum

 Aug 22 2011 6:09 PM
Hello,

I am creating a table using row and column continuation and have come across something that I can't quite figure out.

Currently I create my table as follows:

/// <summary>
                /// Creates a generic table
                /// </summary>
                /// <returns>Table2 object</returns>
                private Table2 CreateTable(ILayout layout)
                {
                        // Instantiate table
                        Table2 tbl = new Table2(0, 0, layout.TableWidth, layout.PageHeight);

                        // Add columns to main table
                        foreach (KeyValuePair<string, float> kvp in HeaderColumns)
                        {
                                tbl.Columns.Add(kvp.Value);
                        }

                        // Set column header repeat count to 1 to repeat top header row
                        tbl.RepeatColumnHeaderCount = 1;

                        // Set border and border color
                        tbl.Border.Width = 0.5f;
                        tbl.Border.Color = new WebColor("#666666");

                        return tbl;
                }

Next, I add a number of rows with the following code:

/// <summary>
                /// Creates a row with therapy class data
                /// </summary>
                /// <returns>Row2 object</returns>
                private void CreateTherapyClassRow(Row2 row, TherapyClass therapyClass, bool isContinuation)
                {
                        WebColor bgColor1 = new WebColor("#333333");
                        WebColor bgColor2 = new WebColor("#777777");

                        // Instantiate row
                        string text = "<font color='white'><b>" + therapyClass.Name + "</b></font>";

                        if (isContinuation)
                                text = "<font color='white'><b>" + therapyClass.Name + " (continued)</b></font>";

                        // Create cell and add to row
                        Cell2 c = row.Cells.Add(CreateFormattedTextArea(text, Layout.TableWidth, false, 0));
                        c.BackgroundColor = (therapyClass.ParentID == -1) ? bgColor1 : bgColor2;
                        c.Padding = m_Padding;
                        c.VAlign = VAlign.Center;
                        c.Align = TextAlign.Left;
                        c.ColumnSpan = 3;
                }

When viewing this, my table has an outside border as expected, but the internal cells have borders that look fine except at the top, left, right, and bottom of the main (outside) table. 

The top left Therapy Class cell in the table has two borders, 1 on the outside and 1 a few units in on the top, left, and right sides.  The next row looks fine with the border matching up, however again on the left and right sides there are double borders.

I've stripped out all of my code down to only creating the table, and adding the therapy class rows as shown above and I can't figure out how to fix the issue.  I've also changed the background color of the cells to see if the coloring extends to the innermost borders, or all the way out, and the coloring indeed extends all the way to the outermost borders of the table.

Below is an approximation of what is happening. The plus (+) signs extend the border in all directions to the closest border.

---------------------------------------
|+-----------------------------------+|
||                                   ||
||                                   ||
||                                   ||
---------------------------------------
||                                   ||
||                                   ||
||                                   ||
+-------------------------------------+

Any ideas?
 Aug 22 2011 6:12 PM
It looks like my ascii table didn't come out quite like it looked in the forum editor.  Please assume the double lines that are in the middle of the table are on the right-hand side and in line with the edge, just like the left-hand side.
 Aug 23 2011 6:34 AM
Posted by a ceTe Software moderator
Hello,

We did some testing on our end using the code which you have sent. We are not able to recreate the behavior which you mentioned in the above posting.

Can you please send over the output PDF document and the sample code which uses static data to our support team at: support@cete.com so that they can recreate the behavior? This information will help them to look into it further.

Thanks,
ceTe Software Support Team.
 Aug 23 2011 7:22 AM
I am currently testing this component for a project and I got the same problem I think.

This problem appears when you modify the border.width value (0.5f) in your case.

First set the same size to table.Border.Width than in table.CellDefault.Border.Width

After that your table shloud be better, but, depending the width value and the zoom percentage on your PDF double lines will appears.

The only solution I found was keep 1f in the width value.

DynamicPDF Developpers may have a solution ?
 Aug 23 2011 8:19 AM
Posted by a ceTe Software moderator
Hello,

We did some further testing on this issue and we have found that this issue has been resolved in the latest build dll file. Please contact our support team at: support@cete.com with reference to this forum posting so that they can provide you the link to download the latest dll files for version 6 DynamicPDF for .NET product.

Thanks,
ceTe Software Support Team.
 Aug 23 2011 2:19 PM
Thank you very much, that did indeed fix the issue.

All times are US Eastern Standard time. The time now is 11:23 PM.