I use Windows Forms Pack 12.1 and am attempting to export wingrid to PDF, with some more details in the PDF, along with the grid
Here is the code that I found on some of your help docs + forums, but it wont work
It exports the grid, but does not add any header, footer, paging sections
What am I missing?
All help appreciated
var exportedFilePath="c:\report.pdf";
var report = new Report();
ISection gridSection = this.ultraGridDocumentExporter1.Export(dgReport, report); gridSection.PageOrientation = PageOrientation.Landscape; gridSection.PageNumbering.Template = "Page [Page #] of [TotalPages]"; //gridSection.PageNumbering.OffsetY = -18;
ISectionHeader headerSection = gridSection.AddHeader(); headerSection.Repeat = true;
IText headerText = headerSection.AddText(0, 0); headerText.AddContent("TEST REPORT HEADER");
report.Publish(exportedFilePath, FileFormat.PDF);
//the pdf file is created, but there is no header, footer, the grid prints well to the PDF
Hello Ameya,
You could achieve the desired behaviour by moving the grid in the BeginExport event of the exporter component:
private void ultraGridDocumentExporter1_BeginExport(object sender, Infragistics.Win.UltraWinGrid.DocumentExport.BeginExportEventArgs e) { e.Section.PageAlignment.Vertical = Alignment.Middle; }
Is this what you are after?
Thank you Boris, your solution worked
But did you notice that the title actually goes behind the grid on the page
In your example the grid is quite small, has less columns
Try adding more columns so that it fills up the exported PDF page, you will see that the title gets hidden behind the grid
So, no, this is still not working for me
Thanks for checking on the post
I am checking about the progress of this issue. Please let me know If you need any further assistance on this.
I made some changes to the code and wrapped it up in a small project. Please take a look at it and let me know if you have any questions, I will be glad to assist you further on this.