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
85
Print and export grid contents on A4 size paper.
posted

Hi,

 

I want to perform Print, Export to Excel and Export to PDF options on ultragird. The grid contains drill down information up to 3 levels.

 

  1. I am using ultraGridPrintDocument component to print grid contents. I want to print the entire grid on A4 size paper. As level 3 contains approx 8 to 10 columns, it won’t fit into a single A4 page during print operation. Is there any way I can fit all the columns to A4 page during print operation.
  2. I am using ultraGridExcelExporter component to export the grid content to Excel 2003 and 2007 format. I again want to export the data in such a way that user should be able to print Excel document on A4 size paper without doing any change manually to the exported document.
  3. I am using ultraGridDocumentExporter component to export grid contents to PDF file. Since the grid contains drilldown information, by default ultraGridDocumentExporter component exports the grid in ‘expanded’ format. What I want to achieve is that is end user expand only specific row on the user interface and clicks on export to PDF button, the output PDF should have only that particular record expanded. Is there any way I can achieve this. Further the exported document should fit on A4 size paper.

 

Thanks in advance.

 

  • 469010
    Suggested Answer
    Offline posted

    Prasad Honrao said:
    • I am using ultraGridPrintDocument component to print grid contents. I want to print the entire grid on A4 size paper. As level 3 contains approx 8 to 10 columns, it won’t fit into a single A4 page during print operation. Is there any way I can fit all the columns to A4 page during print operation.

    Depending on what you are doing, you might need to do this in InitializePrint instead of, or in addition to, InitializePrintPreview.


            private void ultraGrid1_InitializePrintPreview(object sender, CancelablePrintPreviewEventArgs e)
            {
                e.DefaultLogicalPageLayoutInfo.FitWidthToPages = 1;
            }

    Prasad Honrao said:
    I am using ultraGridExcelExporter component to export the grid content to Excel 2003 and 2007 format. I again want to export the data in such a way that user should be able to print Excel document on A4 size paper without doing any change manually to the exported document.

    The grid has no control over how Excel will print the document. I don't see any way to do this.

    Prasad Honrao said:
    I am using ultraGridDocumentExporter component to export grid contents to PDF file. Since the grid contains drilldown information, by default ultraGridDocumentExporter component exports the grid in ‘expanded’ format. What I want to achieve is that is end user expand only specific row on the user interface and clicks on export to PDF button, the output PDF should have only that particular record expanded. Is there any way I can achieve this. Further the exported document should fit on A4 size paper.

    The rows are all expanded by default. But I think you can change this by handling the InitializeRow event on the UltraGridDocumentExporter and copying the expanded state from the "real" grid row on the screen to the print row. To get the real row from the print row, you do something like this:


                UltraGridRow realRow = this.ultraGrid1.GetRowFromPrintRow(e.Row);
                e.Row.Expanded = realRow.Expanded;