feat(pdf-export): add per-column styles, grouped column headers, configurable colors, document properties, and autoTableOptions callback#2413
Conversation
2102144 to
ab11fc5
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2413 +/- ##
========================================
Coverage 100.0% 100.0%
========================================
Files 196 196
Lines 24248 24375 +127
Branches 8488 8543 +55
========================================
+ Hits 24248 24375 +127
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
angular-slickgrid
aurelia-slickgrid
slickgrid-react
slickgrid-vue
@slickgrid-universal/angular-row-detail-plugin
@slickgrid-universal/aurelia-row-detail-plugin
@slickgrid-universal/react-row-detail-plugin
@slickgrid-universal/vue-row-detail-plugin
@slickgrid-universal/binding
@slickgrid-universal/common
@slickgrid-universal/composite-editor-component
@slickgrid-universal/custom-footer-component
@slickgrid-universal/custom-tooltip-plugin
@slickgrid-universal/empty-warning-component
@slickgrid-universal/event-pub-sub
@slickgrid-universal/excel-export
@slickgrid-universal/graphql
@slickgrid-universal/odata
@slickgrid-universal/pagination-component
@slickgrid-universal/pdf-export
@slickgrid-universal/row-detail-view-plugin
@slickgrid-universal/rxjs-observable
@slickgrid-universal/text-export
@slickgrid-universal/utils
@slickgrid-universal/vanilla-bundle
@slickgrid-universal/vanilla-force-bundle
commit: |
…igurable colors, document properties, and autoTableOptions callback - Add per-column textAlign support via columnStyles (body cells) and didParseCell hook (header cells) - Add grouped column header (pre-header) row support in AutoTable path using colSpan merging - Add 6 configurable styling properties: headerBackgroundColor, headerTextColor, preHeaderBackgroundColor, preHeaderTextColor, alternateRowColor, cellPadding - Add documentProperties option for PDF metadata (title, author, subject, keywords, creator) - Add autoTableOptions callback for advanced AutoTable customization - Apply all styling options to both AutoTable and manual fallback rendering paths - Add 28 new tests (110 total, all passing) - Update README with grouped headers, per-column alignment, styling options, document properties, and callback docs Closes #2406
ab11fc5 to
61b11e9
Compare
packages/pdf-export/README.md
Outdated
| }); | ||
| ``` | ||
|
|
||
| ### Using jspdf-autotable |
There was a problem hiding this comment.
this readme should be a very basic instructions of how to install it and add it as a resource. But more in-depth documentation like this should be moved to the online docs, there's a file named export-to-pdf.md and you should move that full docs to that file so that we can see it from the official GitBook docs. Also note that there's 5x files (4x frameworks + 1x native usage)
There was a problem hiding this comment.
agree that would be better, didn't think about it. will fix it
| /** PDF document keywords (comma-separated string) */ | ||
| keywords?: string; | ||
| /** PDF document creator (application name) */ | ||
| creator?: string; |
There was a problem hiding this comment.
wow that is a lot of configs, do we really need all of this? Are you expecting to use this in the future? All I have in Excel is the filename that can be customized
There was a problem hiding this comment.
PDFs are often sent by our customers to their customers, so they need to look more official. Spreadsheets are only used internally by our customers. So, yes being able to set documentProperties is very nice to have. But we can do it by subclassing or the autoTableOptions callback 😏
You have the final say 🥺
There was a problem hiding this comment.
you can keep them if you intend to use them, I was just making sure that we're not going crazy with implementing every possible option because of the vibe coding (sometime copilot is a little too excited lol). So if you use them and want to keep them that's fine.
|
@jr01 will you be able to update the PR today? I was waiting for this PR before releasing v10, so if you can make the update today that would be great. Thanks |
|
@ghiscoding No, sorry, unfortunately don't have the time today. Even though it should just be a some minutes. But I think this PR is not important for v10. So please go ahead with releasing v10 and sorry if I held you up with that. I'll fix this PR this week. |
- trim pdf-export README to match master baseline; only add jspdf-autotable dep, optional install, applyPlugin snippet, and new feature bullets - move detailed feature docs (colors, textAlign, documentProperties, autoTableOptions, grouped headers) to export-to-pdf.md across all 4 framework variants - remove dead-code ?? and || fallbacks for values guaranteed by DEFAULT_EXPORT_OPTIONS, replace with ! assertions - add missing tests to reach 100% patch coverage
8e284bb to
ccd46d1
Compare
|
hey @ghiscoding - I did some rework per your review comments, can you take a swing at this PR again? No hurry! |
|
🎉 This pull request is included in version 10.1.0 📦 |


Summary
This PR adds several PDF export enhancements as discussed in #2406:
Per-column text alignment
pdfExportOptions: { textAlign: 'right' }to control alignment individuallycolumnStyles+didParseCellfor headers) and manual fallback pathsGrouped column headers (pre-header row)
createPreHeaderPanelandshowPreHeaderPanelare enabled, the PDF export now renders grouped column headers with propercolSpanmerging in the AutoTable pathConfigurable styling
headerBackgroundColor/headerTextColor— header row colors (RGB tuples)preHeaderBackgroundColor/preHeaderTextColor— pre-header row colorsalternateRowColor— alternate (odd) row background colorcellPadding— cell padding in ptDocument properties (metadata)
documentPropertiesoption to set PDF metadata (title, author, subject, keywords, creator) viadoc.setDocumentProperties()AutoTable options callback
autoTableOptionscallback to customize jsPDF-AutoTable options before renderingTests
Screenshot
Showing grouped column headers, alignment (in header and row values), alternate styling & document properties:

Remarks
Fully vibe coded, including most of this comment as well 😁
Closes #2406