mui / mui-x

MUI X: Build complex and data-rich applications using a growing list of advanced React components, like the Data Grid, Date and Time Pickers, Charts, and more!
https://mui.com/x/
4.1k stars 1.27k forks source link

[data grid] Is it possible to add a heading to datagrid export? #11969

Open mingvst opened 7 months ago

mingvst commented 7 months ago

The problem in depth

We are having issues figuring out how to add text fields to an export of mui components, specifically adding a heading to the datagrid export, with the intention of supplying a PDF file to our customers.

Your environment

`npx @mui/envinfo` System: OS: macOS 14.3 Binaries: Node: 21.1.0 - /opt/homebrew/bin/node npm: 10.2.0 - /opt/homebrew/bin/npm pnpm: Not Found Browsers: Chrome: 121.0.6167.139 Edge: Not Found Safari: 17.3 npmPackages: @emotion/react: ^11.11.3 => 11.11.3 @emotion/styled: ^11.11.0 => 11.11.0 @mui/base: 5.0.0-beta.30 @mui/core-downloads-tracker: 5.15.3 @mui/icons-material: ^5.15.3 => 5.15.3 @mui/material: ^5.15.3 => 5.15.3 @mui/private-theming: 5.15.3 @mui/styled-engine: 5.15.3 @mui/system: 5.15.3 @mui/types: 7.2.12 @mui/utils: 5.15.3 @mui/x-charts: ^6.18.4 => 6.18.4 @mui/x-data-grid: 6.18.6 @mui/x-data-grid-premium: ^6.18.6 => 6.18.6 @mui/x-data-grid-pro: 6.18.6 @mui/x-date-pickers: ^6.18.6 => 6.19.0 @mui/x-date-pickers-pro: ^6.19.0 => 6.19.0 @mui/x-license-pro: ^6.10.2 => 6.10.2 @types/react: ^18.2.46 => 18.2.46 react: ^18 => 18.2.0 react-dom: ^18 => 18.2.0 typescript: ^5.3.3 => 5.3.3

Search keywords: datagrid export pdf text Order ID: 79227

michelengelen commented 7 months ago

AFAIK It is currently not possible to add custom elements to the print export. This seems like a nice feature to have, so I'll add the "waiting for upvotes" label.

mingvst commented 7 months ago

Thank you for the clarification, heres to hoping it will eventually get implemented :)

flaviendelangle commented 7 months ago

I think it should be possible to manually add those headings using our exceljsPostProcess You have a very basic doc example here

michelengelen commented 7 months ago

I think it should be possible to manually add those headings using our exceljsPostProcess You have a very basic doc example here

But this is for excel only, right? @mingvst was asking about a PDF file and thats vie print ony, right? 🤔

flaviendelangle commented 7 months ago

Oh sorry I read too fast... Maybe we could provide a similar API for PDF and/or print

michelengelen commented 7 months ago

Oh sorry I read too fast... Maybe we could provide a similar API for PDF and/or print

Yep, I thought the same. That's basically why I added the "waiting for upvotes" label.