Skip to content

feat(export): add opt-in includeColumnWidth for Excel and PDF exports - #2697

Open
ghiscoding wants to merge 7 commits into
masterfrom
feat/export-include-column-width
Open

feat(export): add opt-in includeColumnWidth for Excel and PDF exports#2697
ghiscoding wants to merge 7 commits into
masterfrom
feat/export-include-column-width

Conversation

@ghiscoding

@ghiscoding ghiscoding commented Aug 5, 2026

Copy link
Copy Markdown
Owner

vibe coded with Copilot using GPT-5.3-Codex

after recently adding variable row height in Excel/PDF exports, I figured that we should also add the column width as well but as opt-in.

Why

Exports were already handling row height fidelity, but column width fidelity was inconsistent:

  • Excel width export mostly relied on export-specific width settings and global fallback.
  • PDF had width support in parts of the flow, but not consistent parity across rendering paths.
  • Because runtime grid columns typically end up with a width value (defaulted by grid internals), enabling width import by default would silently change many existing exports.

This change introduces an explicit, safe way to export using grid column widths without breaking current behavior.

What changed (behavior)

A new option is introduced for both Excel and PDF:

  • includeColumnWidth: boolean (default false)

When includeColumnWidth is false:

  • Existing behavior is preserved.

When includeColumnWidth is true:

  • Export uses column definition width as fallback source for each column width.

Width resolution precedence is now explicit:

  1. Per-column export width (highest priority)
  2. Column definition width when includeColumnWidth is true
  3. Existing global/default fallback behavior

In plain terms:

  • If you already set export-specific width, nothing changes.
  • If you do not set export-specific width and opt in, export follows your grid column width.
  • If you do not opt in, export keeps prior defaults.

Why opt-in

This is intentionally opt-in for backward compatibility:

  • Grid columns generally have a width at runtime (explicit or defaulted).
  • A default-on approach would alter output for many users unexpectedly.
  • Opt-in keeps existing exports stable while enabling fidelity for users who want WYSIWYG width behavior.

Notes on units

  • Excel width uses Excel column-width units (not pixels).
  • PDF width uses points (pt), consistent with jsPDF defaults.
  • includeColumnWidth uses the column width value as-is within each export pipeline’s existing unit semantics.

Scope details

  • Applied to Excel export width logic.
  • Applied to PDF export width logic in both render paths:
  1. jsPDF AutoTable path
  2. Manual fallback rendering path

Validation

  • Targeted Excel export tests pass.
  • Targeted PDF export tests pass.
  • New tests cover default behavior, opt-in behavior, and precedence behavior.

Summary

We now have 2 new options in Excel/PDF exports for row height and column width:

  • includeVariableRowHeight => default true but only when variable row height is enabled
  • includeColumnWidth => default false (opt-in)

Export Demo

image

@codecov

codecov Bot commented Aug 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.0%. Comparing base (4860ea3) to head (45e0ea9).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2697   +/-   ##
=======================================
  Coverage   100.0%   100.0%           
=======================================
  Files         200      200           
  Lines       25465    25502   +37     
  Branches     8999     9019   +20     
=======================================
+ Hits        25465    25502   +37     
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 Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ghiscoding

ghiscoding commented Aug 5, 2026

Copy link
Copy Markdown
Owner Author

cc @jr01 you probably want to be aware of this feature/change since you're using the PDF Export. The summary is that I recently added variable row height and also in Excel/PDF exports, I figured that we should also add the column width as well but as opt-in. We now have 2 new options:

  • includeVariableRowHeight => default true but only when variable row height is enabled
  • includeColumnWidth => default false (opt-in)

@pkg-pr-new

pkg-pr-new Bot commented Aug 5, 2026

Copy link
Copy Markdown
angular-slickgrid

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

aurelia-slickgrid

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

slickgrid-react

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

slickgrid-vue

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

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

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

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

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

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

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

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

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

@slickgrid-universal/binding

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

@slickgrid-universal/common

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

@slickgrid-universal/composite-editor-component

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

@slickgrid-universal/custom-footer-component

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

@slickgrid-universal/custom-tooltip-plugin

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

@slickgrid-universal/empty-warning-component

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

@slickgrid-universal/event-pub-sub

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

@slickgrid-universal/excel-export

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

@slickgrid-universal/graphql

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

@slickgrid-universal/odata

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

@slickgrid-universal/pagination-component

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

@slickgrid-universal/pdf-export

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

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

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

@slickgrid-universal/rxjs-observable

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

@slickgrid-universal/sql

npm i https://pkg.pr.new/@slickgrid-universal/sql@2697

@slickgrid-universal/text-export

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

@slickgrid-universal/utils

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

@slickgrid-universal/vanilla-bundle

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

@slickgrid-universal/vanilla-force-bundle

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

@slickgrid-universal/web-mcp

npm i https://pkg.pr.new/@slickgrid-universal/web-mcp@2697

commit: 45e0ea9

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.

1 participant