Skip to content

feat(pdf-export): add per-column styles, grouped column headers, configurable colors, document properties, and autoTableOptions callback#2413

Merged
ghiscoding merged 2 commits intomasterfrom
feat/pdf-export-column-styles
Mar 6, 2026
Merged

feat(pdf-export): add per-column styles, grouped column headers, configurable colors, document properties, and autoTableOptions callback#2413
ghiscoding merged 2 commits intomasterfrom
feat/pdf-export-column-styles

Conversation

@jr01
Copy link
Collaborator

@jr01 jr01 commented Feb 27, 2026

Summary

This PR adds several PDF export enhancements as discussed in #2406:

Per-column text alignment

  • Columns can now specify pdfExportOptions: { textAlign: 'right' } to control alignment individually
  • Works in both AutoTable (via columnStyles + didParseCell for headers) and manual fallback paths

Grouped column headers (pre-header row)

  • When createPreHeaderPanel and showPreHeaderPanel are enabled, the PDF export now renders grouped column headers with proper colSpan merging in the AutoTable path

Configurable styling

  • headerBackgroundColor / headerTextColor — header row colors (RGB tuples)
  • preHeaderBackgroundColor / preHeaderTextColor — pre-header row colors
  • alternateRowColor — alternate (odd) row background color
  • cellPadding — cell padding in pt

Document properties (metadata)

  • documentProperties option to set PDF metadata (title, author, subject, keywords, creator) via doc.setDocumentProperties()

AutoTable options callback

  • autoTableOptions callback to customize jsPDF-AutoTable options before rendering

Tests

  • 110 tests total (28 new), all passing
  • Covers both AutoTable and manual fallback paths

Screenshot

Showing grouped column headers, alignment (in header and row values), alternate styling & document properties:
image

Remarks

Fully vibe coded, including most of this comment as well 😁

Closes #2406

@jr01 jr01 force-pushed the feat/pdf-export-column-styles branch 2 times, most recently from 2102144 to ab11fc5 Compare February 27, 2026 11:26
@codecov
Copy link

codecov bot commented Feb 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.0%. Comparing base (bbb5b70) to head (ccd46d1).
⚠️ Report is 48 commits behind head on master.

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     
Flag Coverage Δ
angular 100.0% <ø> (ø)
universal 100.0% <100.0%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 27, 2026

angular-slickgrid

npm i https://pkg.pr.new/angular-slickgrid@2413

aurelia-slickgrid

npm i https://pkg.pr.new/aurelia-slickgrid@2413

slickgrid-react

npm i https://pkg.pr.new/slickgrid-react@2413

slickgrid-vue

npm i https://pkg.pr.new/slickgrid-vue@2413

@slickgrid-universal/angular-row-detail-plugin

npm i https://pkg.pr.new/@slickgrid-universal/angular-row-detail-plugin@2413

@slickgrid-universal/aurelia-row-detail-plugin

npm i https://pkg.pr.new/@slickgrid-universal/aurelia-row-detail-plugin@2413

@slickgrid-universal/react-row-detail-plugin

npm i https://pkg.pr.new/@slickgrid-universal/react-row-detail-plugin@2413

@slickgrid-universal/vue-row-detail-plugin

npm i https://pkg.pr.new/@slickgrid-universal/vue-row-detail-plugin@2413

@slickgrid-universal/binding

npm i https://pkg.pr.new/@slickgrid-universal/binding@2413

@slickgrid-universal/common

npm i https://pkg.pr.new/@slickgrid-universal/common@2413

@slickgrid-universal/composite-editor-component

npm i https://pkg.pr.new/@slickgrid-universal/composite-editor-component@2413

@slickgrid-universal/custom-footer-component

npm i https://pkg.pr.new/@slickgrid-universal/custom-footer-component@2413

@slickgrid-universal/custom-tooltip-plugin

npm i https://pkg.pr.new/@slickgrid-universal/custom-tooltip-plugin@2413

@slickgrid-universal/empty-warning-component

npm i https://pkg.pr.new/@slickgrid-universal/empty-warning-component@2413

@slickgrid-universal/event-pub-sub

npm i https://pkg.pr.new/@slickgrid-universal/event-pub-sub@2413

@slickgrid-universal/excel-export

npm i https://pkg.pr.new/@slickgrid-universal/excel-export@2413

@slickgrid-universal/graphql

npm i https://pkg.pr.new/@slickgrid-universal/graphql@2413

@slickgrid-universal/odata

npm i https://pkg.pr.new/@slickgrid-universal/odata@2413

@slickgrid-universal/pagination-component

npm i https://pkg.pr.new/@slickgrid-universal/pagination-component@2413

@slickgrid-universal/pdf-export

npm i https://pkg.pr.new/@slickgrid-universal/pdf-export@2413

@slickgrid-universal/row-detail-view-plugin

npm i https://pkg.pr.new/@slickgrid-universal/row-detail-view-plugin@2413

@slickgrid-universal/rxjs-observable

npm i https://pkg.pr.new/@slickgrid-universal/rxjs-observable@2413

@slickgrid-universal/text-export

npm i https://pkg.pr.new/@slickgrid-universal/text-export@2413

@slickgrid-universal/utils

npm i https://pkg.pr.new/@slickgrid-universal/utils@2413

@slickgrid-universal/vanilla-bundle

npm i https://pkg.pr.new/@slickgrid-universal/vanilla-bundle@2413

@slickgrid-universal/vanilla-force-bundle

npm i https://pkg.pr.new/@slickgrid-universal/vanilla-force-bundle@2413

commit: 2e4037c

…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
@jr01 jr01 force-pushed the feat/pdf-export-column-styles branch from ab11fc5 to 61b11e9 Compare February 27, 2026 11:29
@jr01 jr01 requested a review from ghiscoding February 27, 2026 11:41
});
```

### Using jspdf-autotable
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 🥺

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@ghiscoding
Copy link
Owner

there's missing coverage it seems, 1 of them is partial coverage

partial
image

and missing
image

@ghiscoding
Copy link
Owner

@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

@jr01
Copy link
Collaborator Author

jr01 commented Mar 2, 2026

@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
@jr01 jr01 force-pushed the feat/pdf-export-column-styles branch from 8e284bb to ccd46d1 Compare March 6, 2026 08:16
@jr01 jr01 requested a review from ghiscoding March 6, 2026 08:34
@jr01
Copy link
Collaborator Author

jr01 commented Mar 6, 2026

hey @ghiscoding - I did some rework per your review comments, can you take a swing at this PR again? No hurry!

@ghiscoding ghiscoding merged commit f4c86c0 into master Mar 6, 2026
22 of 23 checks passed
@ghiscoding ghiscoding deleted the feat/pdf-export-column-styles branch March 6, 2026 14:28
@github-actions
Copy link

github-actions bot commented Mar 7, 2026

🎉 This pull request is included in version 10.1.0 📦
🔗 The release notes are available at: GitHub Release 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PDF Export — forward per-column pdfExportOptions to jsPDF‑AutoTable columnStyles

2 participants