Click here to Skip to main content
15,903,724 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear all,
I am using this code for creating table and cells inside the table but their is some problem occured i can not fix the table height and width and also the cell position in table.

Their are few error occurd like c2.left=0 is read only u can't assign values same error is occured during fix the page height.

iTextSharp.text.Table td1 = new iTextSharp.text.Table(1);
                td1.BorderWidth = 1;
                td1.WidthPercentage = 100;
                //td1.Cellpadding = htt1;

                td1.BackgroundColor = new Color(255, 255, 255);
                iTextSharp.text.Cell c2 = new iTextSharp.text.Cell (new 

Phrase("idnum " + idnum + " " + "client "+client,
FontFactory.getFont(FontFactory.TIMES_ROMAN, 7, Font.NORMAL)));
                c2.Border = 1;
                c2.Left = 0;
                //c2.Top = (float)tp * (float)0.22;                

                td1.addCell(c2);
                document.Add(td1);


Help Me in this regard.


Thanks in Advance.
Posted
Updated 4-May-11 19:59pm
v2

1 solution

I think you will find that you can't set the cell position (or widths) directly - the properties are read only - it doesn't really make sense to have a table and then position cells within it absolutely - it kind of stops being a table then.

you can use something like

table.SetWidths(new int[5] {1, 10, 3, 3, 3});

to set the widths of the columns in your table, if that helps
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900