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
705
PDF With Grid & Mutiple header Lines
posted

I currently have a nice report that I can print whose code looks like

ultraGridPrintDocument1 = new Infragistics.Win.UltraWinGrid.UltraGridPrintDocument();           
ultraGridPrintDocument1.Grid = ultraGrid1;
ultraGridPrintDocument1.Header.TextCenter = "Some Header";
ultraGridPrintDocument1.DefaultPageSettings.PaperSize = new System.Drawing.Printing.PaperSize("Legal", 850, 1400);
ultraGridPrintDocument1.DefaultPageSettings.Landscape = true;
ultraGridPrintDocument1.DefaultPageSettings.Margins = new System.Drawing.Printing.Margins(50, 50, 50, 50);
ultraGridPrintDocument1.FitWidthToPages = 1;
ultraGridPrintDocument1.Print();

(also in the initialize print for the grid I have this one line)

e.DefaultLogicalPageLayoutInfo.PageHeader = "Page: <#> of <##>             Trade Date: " + TradeDate.ToShortDateString() + "                  Printed: " + DateTime.Now + "                  By: " + System.Environment.UserName;

 

 

I'm trying to replicate this exact print out in PDF format and am having a few problems.  First the grid is covering the headers.  Second the header isnt displaying a page number.   And third the font size isnt changing.

 

Infragistics.Documents.Report.Text.Style headerStyle = new Infragistics.Documents.Report.Text.Style(new Infragistics.Documents.Graphics.Font("Arial", 8), Infragistics.Documents.Graphics.Brushes.Black);

Infragistics.Documents.Report.Report report = new Infragistics.Documents.Report.Report();
Infragistics.Documents.Report.Section.ISection section = report.AddSection();
Infragistics.Documents.Report.Section.ISectionHeader header = section.AddHeader();           

section.PageOrientation = Infragistics.Documents.Report.PageOrientation.Landscape;
section.PageSize = Infragistics.Documents.Report.PageSizes.A4;

Infragistics.Documents.Report.Text.IText text = header.AddText(0,0);
Infragistics.Documents.Report.Text.IText text2 = header.AddText(0, 10);
text.Alignment.Horizontal = Infragistics.Documents.Report.Alignment.Center;

text.AddContent("Some Header");
text.Style = headerStyle;

text2.Alignment.Horizontal = Infragistics.Documents.Report.Alignment.Left;
text2.AddContent("Page: <#> of <##>       " + System.Environment.UserName);

text2.Style = headerStyle;

ultraGridDocumentExporter1.Export(ultraGrid1, section);

Parents
  • 469350
    Offline posted

    Exporting the grid to a PDF document assumes that the grid will be in it's own section. The grid already uses the Header area, so anything you put in the Header of the section probably won't work well with the the UltraGridDocumentExporter, since it won't know about it.

    If you want the PDF to look exactly like the printed grid, then have you considered getting a PDF print driver so you can simply print to PDF format?

Reply Children