Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
250
WebGrid PDF Printing Issues
posted

Hi,

I have a WebGrid which has PDF printing.But if I make paging = true then the PDF report shows blank.

If I remove paging it works fine.

following is the code:

protected void btnexportpdf_Click(object sender, ImageClickEventArgs e)
    {
        try
        {
            //// configure exporter
            UltraWebGridDocumentExporter1.Format = FileFormat.PDF;
            UltraWebGridDocumentExporter1.DownloadName = "PurchaseRequirementReport.pdf";
            UltraWebGridDocumentExporter1.TargetPaperOrientation = PageOrientation.Landscape;


            UltraWebGridDocumentExporter1.ExportMode = Infragistics.WebUI.UltraWebGrid.Exporter.ExportMode.Download;
            UltraWebGridDocumentExporter1.AutoSizeRows = Infragistics.WebUI.Shared.DefaultableBoolean.True;
            // trigger export
           Line B UltraWebGridDocumentExporter1.Export(grdPurRequirement);
        }
        catch (Exception ex)
        {
            Response.Write(ex.Message);
        }
    }

 

protected void UltraWebGridDocumentExporter1_BeginExport(object sender, Infragistics.WebUI.UltraWebGrid.DocumentExport.DocumentExportEventArgs e)
    {
        // Add a title to the report
        ReportText.IText heading = e.Section.AddText();
        ReportText.Style headingStyle = new ReportText.Style(new Infragistics.Documents.Graphics.Font("Tahoma", 16), Infragistics.Documents.Graphics.Brushes.Crimson);
        heading.AddContent("Purchase Requirement Report :", headingStyle);
        heading.AddLineBreak();
        heading.Alignment = Infragistics.Documents.Report.TextAlignment.Center;
        heading.AddContent("Printed By: Optimal Infotech Pvt Ltd ", headingStyle);
        heading.AddLineBreak();
        heading.Margins.Bottom = 15;

        // Add a caption with some more information
        ReportText.IText caption = e.Section.AddText();
        ReportText.Style captionStyle = new ReportText.Style(new Infragistics.Documents.Graphics.Font("Tahoma", 12), Infragistics.Documents.Graphics.Brushes.Black);
        caption.AddContent("Buyer:", captionStyle);
        caption.AddLineBreak();
        caption.AddContent("Merchandiser:", captionStyle);
        caption.AddLineBreak();
        caption.AddContent("User:", captionStyle);
        caption.AddLineBreak();
        caption.AddContent("From Date:", captionStyle);
        caption.AddLineBreak();
        caption.AddContent("To Date:", captionStyle);
        caption.AddLineBreak();
        caption.Margins.Bottom = 15;

        // Get a reference to the section's PageNumbering object.
        Infragistics.Documents.Report.Section.PageNumbering pn = e.Section.PageNumbering;

        //Add a Footer to the report
        e.Section.PageMargins.All = 40;

        // Create a style for the page numbering font.
        pn.Style = new Infragistics.Documents.Report.Text.Style(Fonts.Arial, Infragistics.Documents.Graphics.Brushes.Black);

        // The Template property is the actual string that shows the page numbering. Use the [Page #] place-
        // holder for the current page and the [TotalPages] place-holder for the total amount of pages in the entire document.
        pn.Template = "Page [Page #] of [TotalPages]";

        // The page numbering will be aligned with the right side of the page. Valid values off the
        // Alignment enum include Left, Center, and Right.
        pn.Alignment.Horizontal = Infragistics.Documents.Report.Alignment.Right;
        // The page numbering will be located at the bottom of the page. Valid values off the Alignment enum include Top and Bottom.
        pn.Alignment.Vertical = Infragistics.Documents.Report.Alignment.Bottom;
        // The page numbering is at the extreme bottom of the page, so we need to change the Y Offset in order to bring it in line with the rest of
        // the page footer text.
        pn.OffsetY = -18;

        Infragistics.Documents.Report.Section.ISectionFooter footer = e.Section.AddFooter();
        footer.Height = 30;
        ReportText.IText text = footer.AddText(0, -18);
        text.AddContent(string.Format("Date printed: {0}", DateTime.Now.ToString("dd-MM-yyyy")));
 Line A }

As soon as debugger goes from Line A to Line B the grid row count becomes zero.before that it shows the no. of rows.

I also tried removing update panel bot nothing improved.

Can anyone provide soln for this.

Parents
No Data
Reply
  • 49378
    posted

    Hi sumeet143,

    I have tested your scenario but was unable to replicate the described issue. It would help to know which version of .NetAdvantage you are using and whether the issue is browser specific.

    My tests were carried out with version 11.1 under Mozilla 5 and IE8, therefore upgrading your product may resolve your issue.

    Please contact me if you have any questions.

    Best Regards,

    Petar Ivanov
    Developer Support Engineer
    Infragistics, Inc.
    http://es.infragistics.com/support

Children
No Data