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
105
export multiple grids to pdf
posted

Hi,

Is it possible to export multiple grids to PDF? If yes, could anybody give me sample of the code? I need to export 3 to 6 grids to the pdf and add titles for each of them in the file.

Thanks,

Himgauri

Parents
No Data
Reply
  • 157
    posted

    In order for you to export multiple grids to the same PDF, you will need an UltraWebGridDocumentExporter for each grid you would like to export. Create a report object and pass that object as your second parameter in the export call for each document exporter. You will also need to set all but the first document exporter's export mode to Custom. Wow that's a mouthful, let me give you some sample code:

     

    UltraWebGridDocumentExporter1.Format = FileFormat.PDF;

    UltraWebGridDocumentExporter1.DownloadName = "report.pdf";

    UltraWebGridDocumentExporter1.TargetPaperOrientation = PageOrientation.Landscape;

    UltraWebGridDocumentExporter2.Format = FileFormat.PDF;

    UltraWebGridDocumentExporter2.DownloadName = "report.pdf";

    UltraWebGridDocumentExporter2.TargetPaperOrientation = PageOrientation.Landscape;

    UltraWebGridDocumentExporter2.ExportMode = Infragistics.WebUI.UltraWebGrid.Exporter.ExportMode.Custom;

    Report oReport = new Report();

    // trigger export

    UltraWebGridDocumentExporter1.Export(UltraWebGrid1, oReport);

    UltraWebGridDocumentExporter2.Export(UltraWebGrid2, oReport);

     

    Now the only issue I have run into with this code is that each grid is added as it's own page to the PDF document. I'm sure that works great in most cases, but in my case I'd like it to place both grids on one page.

     Hope this helps!

    Tyler

Children