We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Grid Export to PDF Problems

I'm trying to format a PDF document that is created by ExportToPdf in a Syncfusion Blazor Datagrid.

I'm attaching copies of the razor page and the PDF document.

I'm having the following problems. Blazor is a new technology for me so some or all of the problems could be caused by a lack of knowledge.

Repeat Heading - I want to display the header only on the first page so I set ExportProperties.IsRepeatHeader to false. But this didn't work. 

Page Number - The page number is shown as a single number on the left of the page. I want to centre the page number and format it so it says Page 1 of 3. I set HAlign = PdfHorizontalAlign.Center in the FooterContent but this didn't work. I don't know how to set the page number to Page 1 of 3.

Adjust Column Widths - All the columns in the report are the same width. I want to make the Description column wider and the other columns narrower. The code that I added isn't working. I don't know how to do this.

Any help will be welcome

Thanks

Brian


 


Attachment: Attachments_6b1d809a.zip

4 Replies 1 reply marked as answer

MS Monisha Saravanan Syncfusion Team November 16, 2022 10:17 AM


Hi Brian,


Greetings from Syncfusion support.


We would like to inform that in DataGrid we don’t have inbuilt support to render customized header and footer. Instead we suggest you to render draw the pdf using pdf library. Kindly check the attached sample and documentation for your reference.


Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/PDFEXP~11246615528.zip


Reference: https://help.syncfusion.com/file-formats/pdf/working-with-headers-and-footers

https://help.syncfusion.com/file-formats/pdf/pdfgrid#table-cell-styles


Please let us know if you have any concerns.


Regards,

Monisha





BC Brian Collings November 17, 2022 02:50 AM

Hi Monisha

Thanks for your reply.

I'm going to try your suggestion and then I'll get back to you.

Regards

Brian




BC Brian Collings November 17, 2022 08:20 AM

Hi Monisha

I had a look at your suggestion  to create a PDF using the PDF Library and decided that it was too complicated for me at the moment.

I decided to keep it simple and stick to DataGrid's inbuilt support. I made the following changes:

Firstly, i decided to drop the page number. 

Secondly, I discovered that I could adjust the column widths in the report after adding ExportProperties.DisableAutoFitWidth = true; 

I'm attaching two copies of the report. The first one is before I made the above changes and the second one is after making the changes. 

Thank you for the help you gave me with this problem. I really appreciate it.

Regards

Brian



Attachment: Attachments_52077d4a.zip

Marked as answer

MS Monisha Saravanan Syncfusion Team November 18, 2022 05:03 AM

Hi Brian,


Welcome. We are glad to hear that you have resolved the reported query on your own. Kindly get back to us if you have further queries. As always we will be happy to assist you.


Regards,

Monisha


Loader.
Live Chat Icon For mobile
Up arrow icon