Cell.FitWidth sizing problems

I have run into problems where cells will “auto-size” instead of being set to the width that I wish them to be. This is a really strange problem because it works most of the time. I also found that when it does not work, it happens within the same table, and it can happen for more than one cell.

There is too much code to paste here, so I will try to at least put the basics in here for anyone trying to reproduce the problem.

The Section Margins are as follows:

this.mainSection.PageInfo.Margin.Left = 20;
this.mainSection.PageInfo.Margin.Right = 20;
this.mainSection.PageInfo.Margin.Top = 40;
this.mainSection.PageInfo.Margin.Bottom = 40;

The widths that I used for the cells (for each row) are as follows:

float column1 = 60;
float column2 = 20;
float column3 = 40;
float columnCode = 35;
float column11 = 40;
float column12 = 40;
float column13 = 40;
float column14 = 40;
float column15 = 25;

Note: the “columnCode” is re-used seven times in each row.

I am also using a border with these cells:

GraphInfo graphInfo = new GraphInfo();
graphInfo.LineWidth = 1;
graphInfo.Color.ColorSpaceType = ColorSpaceType.Rgb;
graphInfo.Color.RgbColorSpace = System.Drawing.Color.White;

BorderInfo border = new BorderInfo();
border.Bottom = graphInfo;
border.Top = graphInfo;
border.Left = graphInfo;
border.Right = graphInfo;

The only reason for the white border is that I want my text to match up correctly under the “headings”. The “headings” were created in another table and are located above the table where this problem is occurring.

The first row in the table has a problem with column 3. Column 3 ends up being 1.5 - 2 times larger than it should be. When this happens, all subsequent rows will have column 2 being twice it’s set size, and column 3 will be set to it’s correct size.

Currently this problem happens all the time, and no matter what size I set the FitWidth property to.

I also have other situations where I am using different sizes and different numbers of columns and it all works fine.

Have you encountered a problem like this? I can send you the generated PDF (with some privacy modifications) so you can see the problem.

If you cannot duplicate the problem then let me know. I will have to piece together a non-database reliant version of my code to send to you if you need it.

Dear marksman,

Thanks for your consideration.

I am sorry, I can’t duplicate the problem. I have tested the following XML and it seems work fine. Wowld you please piece together a non-database reliant version of your code and send it to tommywang3465@hotmail.com?

<?xml version="1.0" encoding="utf-8" ?>









cell1







cell2







cell3







cell4







cell5







cell6







cell7







cell8







cell9







cell10







cell11







cell12







cell13







cell14







cell15







I figured out the problem. It’s not really a bug with your component, but it is a strange result to a situation that I can prevent.

The problem occurs when I create a row, create a couple cells, and then do not add that row to the table. The next loop occurs and creates a row, creates a couple cells, and then adds the row to the table.

It appears that the cells that were created but were not added to the table were interfering with the cells that were added to the table.

If this situation can be remedied, it would be greatly appreciated, but if not then it can easily be worked around.

Thanks,