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
440
Exporting Grid to PDF - margins and grid scaling
posted

I'm trying to export to PDF and produce the same results as we get from the UltraGridPrintDocument when printing. I can produce a PDF using the UltraGridDocumentExporter (as below), but I can't seem to control the margins, or the size of the grid (i.e. not just scaling to fit one page). Also, if I try to export a large grid I get an 'OutOfMemoryException'.

    Infragistics.Documents.Report.Report report = new Infragistics.Documents.Report.Report();
    ultraGridDocumentExporter1.AutoSize = Infragistics.Win.UltraWinGrid.DocumentExport.AutoSize.SizeColumnsAndRowsToContent;
    ISection section = report.AddSection();
    section.PageMargins.Left = 30;
    section.PageMargins.Top = 20;
    section.PageMargins.Bottom = 20;
    section.PageMargins.Right = 30;

    ISectionHeader _header = section.AddHeader();
    _header.Height = 80;
    IText rptHeader = _header.AddText(0, 0);
    Style textStyle = new Style(new Infragistics.Documents.Graphics.Font("Tahoma", 18), Infragistics.Documents.Graphics.Brushes.Black);
    rptHeader.Alignment = TextAlignment.Center;
    StringBuilder headerText = new StringBuilder();
    headerText.Append("left text");
    headerText.Append("center text");
    headerText.Append("right text");
    rptHeader.AddContent(headerText.ToString(), textStyle);

    ISectionFooter _footer = section.AddFooter();
    _footer.Height = 80;
    IText rptFooter = _footer.AddText(0, 0);
    StringBuilder footerText = new StringBuilder();
    footerText.Append("footer left text ");
    footerText.Append("center text   ");
    footerText.Append("right text);
    rptFooter.Alignment = TextAlignment.Center;
    rptFooter.AddContent(footerText.ToString(), textStyle);

    ultraGridDocumentExporter1.Export(ultraWinGrid1, section);
    report.Publish(@"C:\test.pdf", Infragistics.Documents.Report.FileFormat.PDF);

Help appreciated! thanks

Parents Reply Children