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,
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.
I am checking about the progress of this issue. Please let me know If you need any further assistance on this.
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
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?
I have not tried the above "e.Section.PageAlignment.Vertical = Alignment.Middle;" code
But I am pretty sure there is sure its not connected to what I am saying
I am saying the z-index of title is lesser than z-index of the grid
In your example, dont go far, add 20 more columns to the grid with finite data in the cells
You will see that the title gets hidden "behind" the grid - the grid overlays the title (I cant find better ways to describe this)
I tried reducing Y co-ord for the title, but that does not help either
Since you have not tried my suggestion, how can you be sure that it does not work? I find it usable, since there is not any property like a z-index, while exporting the grid and I do not see how it could help, if it was there. If the header was above the grid it will overlay part of it and I think that this is not desired.
Could you please try my suggestion and let me know if you feel that I misunderstood you.
Here you go.. tried it.. see attached PDF generated by your sample and testing 1 line code above "e.Section.PageAlignment.Vertical = Alignment.Middle"
Your suggestion has only moved my grid in the middle of the page, that's no use because my grid spans 3 PDF pages
I wish you would have tried my suggestion of adding 20 columns and 200 rows to your own code / grid, then you would know what I am saying
But that's alright, some developers are just more confident of their work
https://docs.google.com/file/d/0B42CvR3rv2CxTU4xVEVYY2ZZUkU/edit
https://docs.google.com/file/d/0B42CvR3rv2CxdlZpQm1NM3lYeUE/edit
Hi,
This is entirely my mistake, sorry for the inconvenience! I took some time researching this and came to the conclusion that the text I am adding has to be somehow 'refreshed'. I achieved this by adding an 'IText' to the section in the 'BeginExport' event. Please try the sample attached to this post.
Thank you for the patience, understanding and dedication to this!