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
1871
PDF and XPS exporting second grid resulting in different page sizes.
posted

I have two grids that I export. Each grid has a section that is added to the report. The first grid is about 50 columns. Obviously the grid cannot fit on one portrait sized page without being shrunk. The second grid is only 3 columns and can fit on any portrait size page without being shrunk.

The issue I am having is the page size of first grid is wider than the page size of the second grid. Is this something I can fix or is this just how it works. I have added an image of the issue.

  • 469350
    Offline posted

    The way the exporter works is that it resizes the section to fit all of the columns in the grid. Since the PDF and XPS formats do not support spanning horizontally across pages, the only way to ensure that the grid fits on the page is to make the page wide enough to fit everything.

    Since your first grid is wider than your second grid, you could simply export the first grid into a Section, get the PageSize on that second and apply the same PageSize to the second section. Of course, you have to set the PageSize on the second section only AFTER the grid has been exported, since the exporter will set the PageSize during the export process.

  • 48586
    Suggested Answer
    posted

    Hello ,

     

    One possible way to avoid this issue is to set TargetPapaerSize of UltraGridDocumentExporter to be enough big to fit first grid and then and second grid will be exported to this size. Please use code like :

    ultraGridDocumentExporter1.AutoSize = Infragistics.Win.UltraWinGrid.DocumentExport.AutoSize.SizeColumnsToContent;

                ultraGridDocumentExporter1.TargetPaperSize = new PageSize(2500, 1000);

               

                Report rep = new Report();

               

                ISection ug1 = rep.AddSection();

                ISection ug2 = rep.AddSection();

     

     

                ultraGridDocumentExporter1.Export(ultraGrid1, ug1);

                ultraGridDocumentExporter1.Export(ultraGrid2, ug2);

     

                rep.Publish("Test.pdf", FileFormat.PDF);

     

    Please let me know if you have any further questions.