You must Sign In to post a response.
  • Category: Windows

    How to set the column width of pdftable dynamically using itextsharp

    I am doing code in vb. I have created table using itextsharp PDF File , and binding my table with database, so at every time I have no any idea about how many columns. and I want my table in which column width is adjustable as per my data which is coming from database.

    I can't use below line
    'Dim widths() As Single = New Single() {4.0F, 4.0F, 4.0F}
    bcoz my database column changes every time ...
    so please help me how can set width based on datatable column count

  • #761451
    Hello Emmi,

    Try this working code :

    PdfPTable table = new PdfPTable(new float[] { 30f, 400f });
    table.HorizontalAlignment = 0;
    table.TotalWidth = 500f;
    table.LockedWidth = true;

    Hope this the exactly you are looking for.

    Nirav Lalan
    DNS Gold Member
    "Failure is the path of least persistence"

  • Sign In to post your comments