iTextSharp to generate a gridview in pdf

前端 未结 2 1325
不知归路
不知归路 2021-01-26 12:25

I\'m trying to export a gridview to pdf with package iTextSharp.

I\'m doing it in my .aspx files :

相关标签:
2条回答
  • 2021-01-26 12:38

    Add the Rendering Function after your PDF code

    public override void VerifyRenderingInServerForm(Control control)
        {
            // verifies the control is rendered here
        }
    
    0 讨论(0)
  • 2021-01-26 12:42

    Add below code to avoid runat="server" error.

    public override void VerifyRenderingInServerForm(Control control)
    {
        /* Verifies that the control is rendered */
    }
    

    You may want to disable paging so that it exports all rows of Gridview to PDF.

    Add below code before gridview's rendercontrol method.

     gvReportingStockComp.AllowPaging = false;
     gvReportingStockComp.DataBind();
    

    Incase you've any doubt, refer below article.

    http://www.aspsnippets.com/Articles/Export-GridView-To-Word-Excel-PDF-CSV-Formats-in-ASP.Net.aspx

    0 讨论(0)
提交回复
热议问题