docs: document setting column widths via configureOptionsUsing (#213) - #417
Open
elminson wants to merge 1 commit into
Open
docs: document setting column widths via configureOptionsUsing (#213)#417elminson wants to merge 1 commit into
elminson wants to merge 1 commit into
Conversation
Column widths are already supported through OpenSpout's writer options, but that was undocumented, so #213 reads as "not possible". Add an Advanced usage section showing setColumnWidth() and setColumnWidthForRange(), noting that column numbers are 1-based, that it works with streaming exports (widths are written at finalization, not per row), and that csv ignores it. Automatic sizing to fit content is still not available; this documents the explicit-width path only. Refs #213
Collaborator
Author
|
Hi @dannyyol 👋 — gentle nudge that this is waiting on your review. It is docs-only, no code: it documents that explicit column widths already work through Thanks, and enjoy your weekend! 🙌 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
#213 ("Auto size Excel column width") has been open since 2021 with 7 comments, and the answer on the thread is that widths are not possible. That is only half true: explicit column widths already work through OpenSpout's writer options and
configureOptionsUsing()— it was simply never documented. Several commenters were asking for exactly this.Change
Docs only, no code. Adds an "Set column widths" section under Advanced usage covering:
setColumnWidth(width, ...$columns)andsetColumnWidthForRange(width, $start, $end)xlsx/odssupport widths andcsvignores themVerified
Every snippet was run before being documented:
setColumnWidth(40, 1)+setColumnWidth(15, 2, 3)<col min="1" max="1" width="40"/><col min="2" max="3" width="15"/>setColumnWidthForRange(20, 1, 4)<col min="1" max="4" width="20"/><col min="1" max="1" width="33"/>odsexportRefs #213 — deliberately not "Closes", since auto-sizing is the actual request and remains open.