New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Data Grid - Export to PDF #14345
Comments
I like this feature and the direction you guys are going with it. However, what I minimally need right now is to be able to specify where a dxDataGrid page breaks to account for footers. Our use case: We (meaning I) are taking a huge amount of CRUD data and assembling a very large report with many sections, many grids, and other content including text, images, headers, footers. The problem: Browsers have very limited support for the CSS Paged Media specification . In particular, they don't support margin locations. If I am printing a large report, I can't put a footer on with regular CSS:
This doesn't work because the datagrids and other content run "behind" the footer to the margin before breaking. If browsers supported the specification, I could simply specify that the footer goes in the "bottom-center" margin and everything would be great, since the the content rendered in the main section would never overrun the margin. In the future I am going to try to get Paged.js working in my React app. Paged.js is a FOSS polyfill that attempts to implement the CSS Paged media spec. It is on npm. I guess what I really want is for DevExpress to apply its substantial technical chops to the project and then add special magic to make it more usable. I'm sorry if this substantially expands the scope of this initiative, perhaps prohibitively so. dxDataGrids actually print very nicely apart from the page break issue. Anyway, this is where I am in the whole PDF/printing odyssey, which on the whole has been surprisingly disappointing. I can't believe browsers have such limited support for proper print layout, given that every non-tech business is addicted to printing. |
First of all, thanks for this great addition, we will use it a lot. |
Hello, @code123xy
You need to use the headStyles option: Here is a sample: https://codepen.io/kuznetsovvn/pen/bGpMQbe |
If the customer wanted to print a paper copy of the datagrid, does the browser do a good job of printing the grid? Or do you recommend piping to PDF first and then printing? Thanks! |
Hello, @bobbyconnolly We do not officially support the browser printing functionality, and the resulting document may vary in different browsers. So, if it's possible, it's better to export the grid before printing it. This will allow you to have the same behavior and appearance across different browsers. |
Angular demo https://js.devexpress.com/Demos/WidgetsGallery/Demo/DataGrid/ExportToPDF/Angular/Light/ does not work. Nothing happen on button click. |
Hello, @PetarBgd Thank you for notifying us of this issue. |
Hello, Will there be option to put columns on the second page? I have about 30 columns on my grid and would like to have 10 columns per page. Thanks, |
Hello, @apanchati We currently have no plans to support this functionality. Should you have any questions, feel free to contact us. |
Thank you to everyone who gave us early feedback. The Export to PDF (CTP) feature is now available in v20.2 release. We would appreciate it if you take a quick poll and leave your feedback in comments. |
Hello, @H-M90 The issue occurs because fonts are configured incorrectly in your application. For more information, please refer to this article: Use of Unicode Characters / UTF-8. I have created a simple sample to demonstrate export with Arabic characters: https://codepen.io/kuznetsovvn/pen/abZaOJY. |
Hello, @H-M90 Please make sure that you are using the rtlEnabled option of our DataGrid and set the setR2L option of the resulting pdf document to false. In this case, the grid should be exported correctly. For example, please refer to the sample CodePen project from my previous comment. If this does not help or if you have further questions related to your specific scenario, feel free to contact us in our Support Center - devexpress.com/ask. Our support team will be happy to assist you. |
Hello, I have a Data Grid with Master-Detail but when generating the pdf, the Master-Detail is not rendered, am I doing something wrong? Here is my example project: |
Hello, @antoni-sganzerla-reitech At present, PDF Export is in CTP and we do not support the Master-Detail scenario. We will take your scenario into account during further development though I cannot give any promises or estimates here at the moment. If we start working on this feature, it will appear in our Roadmap or on the GitHub page. |
Hello. Will it be possible to export dxCharts (etc) and dxDataGrids into one PDF? Like a sales dashboard with charts and a grid. Thanks! |
Hello, @scss-sschultz You can include any custom content alongside the grid using the library's jspdf functionality. Please check the Include custom content alongside the grid example. |
Would you consider an export option as "raw html" so that the table could be embedded into any application that supports HTML, for example Word? |
Hello, @l3of0x Thanks for sharing your idea with us, we will keep this feature in mind, but now it is not in our plans. |
Helloe @KuznetsovVN How we are going to put some text under the grid. I mean to do that only once. For example Invoice with |
Hello @Javorov1103 , You can use the text method to write text in any position on the page. |
Hi @KuznetsovVN, We have a huge grid with more than 17 columns (count can go up even more) which We had to export to pdf.
The problem with this approach is that the data is huge and it gets hard to understand what page/row belongs to which data. It would be much better if the id column (which is currently fixed on UI) can be added on each subsequent page as well. |
Hi @KuznetsovVN, Thanks for posting this, I was having issues trying to do this. I implemented this on a datagrid with barcode image columns (created with JSBarcode) and worked like a charm. I'm using devextreme on MVC Thanks again |
We plan to replace jsPDF-AutoTable with our own module in the future. |
Hi there, |
Hello, sorry for the delay. |
Hello, In v22.1, we introduced a new PDF exporting API. The new implementation of exporting a DataGrid to a PDF document doesn't use the AutoTable plugin anymore. After using this plugin within the CTP period, our customers encountered a large number of issues that we could not affect and we could not suggest solutions in a reasonable time. We decided to stop using this plugin and implement our own mechanism for this purpose. We kept the previous implementation's
It will be available for a few releases and help you make the migration to the new implementation smoother. Currently, all options must be configured directly through the exportDataGridOptions properties that have a full set of settings that you may need to migrate. We have collected the most common usage scenarios in our Widgets Gallery demos: This information may help you understand how the new API can be used. If you have additional questions, please submit a ticket to our Support Center. We'll review them and find the most suitable solution. |
The Problem
The DevExtreme DataGrid does not allow users to export grid data to PDF documents.
The Proposed Solution
We plan to integrate the third-party jsPDF library and the jsPDF-AutoTable plugin into the DataGrid API and enhance our exportDataGrid method to support export as a PDF.
The proposed solution allows for the following customizations:
The export of the DataGrid with a custom color scheme is not currently supported.
The resulting PDFs will retain DataGrid settings such as grouping, bands, summaries, etc.
Implementation Details
The
exportDataGrid
method accepts the following object:Use Cases
Export DataGrid as is
Customize cell content
Add header and footer
Include custom content alongside the grid
Try It
Live Sandboxes
Installation
Import exportDataGrid, jsPDF, and jsPDF-AutoTable.
We Need Your Feedback
Take a Quick Poll
Do you find export to PDF useful for your projects?
Get Notified of Updates
Subscribe to this thread or to our Facebook and Twitter accounts for updates on this topic.
The text was updated successfully, but these errors were encountered: