Click here to Skip to main content
11,644,982 members (65,010 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET
Hi,

I need to place Itextsharp table in fixed position & need only vertical gridlines.
could u please help how do i do this?

Thanks.

 int columnCount = PrintGv.Columns.Count;
        int rowCount = PrintGv.Rows.Count;
        int tableRows = rowCount + 3;
        iTextSharp.text.Table grdTable = new iTextSharp.text.Table(columnCount, tableRows);
        grdTable.BorderWidth = 1;
        grdTable.BorderColor = new Color(0, 0, 255);
        grdTable.Cellpadding = 1;
        grdTable.Cellspacing = 1;
        grdTable.AddCell("ItemNo");
        grdTable.AddCell("Qty");
        grdTable.AddCell("Description");
 
        for (int rowCounter = 0; rowCounter < rowCount; rowCounter++)
        {
            for (int columnCounter = 0; columnCounter < columnCount; columnCounter++)
            {
                string strValue = PrintGv.Rows[rowCounter].Cells[columnCounter].Text;
                grdTable.AddCell(strValue);
            }
        }
 

        Doc.Add(grdTable);
 
Posted 22-Mar-12 18:26pm

1 solution

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

Solution 1

Hi Mary,

http://blog.rubypdf.com/itextsharp/tutorial01/[^]

here some c# code is the for all your needs using itextSharp.

Any help reply to me.
  Permalink  
Comments
Arokia Mary at 24-Mar-12 11:14am
   
Thanks Shiva for your reply i will try and let you know...
Arokia Mary at 24-Mar-12 12:58pm
   
Hi I am getting a error "The table width must be greater than zero.
"



Stack Trace:


[ArgumentException: The table width must be greater than zero.]
iTextSharp.text.pdf.PdfPTable.WriteSelectedRows(Int32 colStart, Int32 colEnd, Int32 rowStart, Int32 rowEnd, Single xPos, Single yPos, PdfContentByte[] canvases, Boolean reusable) +162
iTextSharp.text.pdf.PdfPTable.WriteSelectedRows(Int32 colStart, Int32 colEnd, Int32 rowStart, Int32 rowEnd, Single xPos, Single yPos, PdfContentByte canvas, Boolean reusable) +458
iTextSharp.text.pdf.PdfPTable.WriteSelectedRows(Int32 colStart, Int32 colEnd, Int32 rowStart, Int32 rowEnd, Single xPos, Single yPos, PdfContentByte canvas) +57
iTextSharp.text.pdf.PdfPTable.WriteSelectedRows(Int32 rowStart, Int32 rowEnd, Single xPos, Single yPos, PdfContentByte canvas) +53
Admin_Pages_DO_Management_Print.btnExport_Click(Object sender, EventArgs e) in c:\Inetpub\wwwroot\Invoice\Admin_Pages\DO_Management\Print.aspx.cs:223
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565

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

  Print Answers RSS
0 OriginalGriff 725
1 jyo.net 494
2 Sergey Alexandrovich Kryukov 464
3 Afzaal Ahmad Zeeshan 404
4 CPallini 386
0 OriginalGriff 1,065
1 Sergey Alexandrovich Kryukov 683
2 DamithSL 681
3 Afzaal Ahmad Zeeshan 662
4 CPallini 555


Advertise | Privacy | Mobile
Web03 | 2.8.150731.1 | Last Updated 24 Mar 2012
Copyright © CodeProject, 1999-2015
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