Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# table itextsharp
this is how i create my table, the table is created and post into pdf. this table have 5 rows and 5 columns.
the problem i having is the table showing at the top of the pdf, i have some title and description at the top, how can i manually set the position of the table?
 
and also how can i resize the width of each column?
PdfPTable table = new PdfPTable(5);
PdfPTable pdft;
            
for (int j = 1; j < 6; j++)
{
   for (int i = 1; i < 6; i++)
   {                    
       pdft = new PdfPTable(1);
       pdft.WidthPercentage = 100f;
       pdft.DefaultCell.Border = 0;
                    
       pdft.AddCell("C" + j.ToString() + i.ToString());
                    
       table.AddCell(pdft);
   }
}
pdfDoc.Add(table);
Posted 21-Feb-13 21:48pm

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Solved, for positioning, use
Paragraph paragraphTable = new Paragraph();
paragraphTable.SpacingAfter = 10f;
 
now still having problem with the width of each column
  Permalink  
v2

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

  Print Answers RSS
0 OriginalGriff 350
1 Jochen Arndt 190
2 Richard MacCutchan 135
3 Sergey Alexandrovich Kryukov 130
4 DamithSL 95
0 OriginalGriff 6,045
1 DamithSL 4,601
2 Maciej Los 4,087
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,310


Advertise | Privacy | Mobile
Web02 | 2.8.141220.1 | Last Updated 22 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100