-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Fix add a maximum column width parameter for Worksheet and check it for autoSize #455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for taking the time to contribute, however we would need to have unit tests before this can merged.
|
I understand, however, the fix is on an old big function, which is not already unit tested. |
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
PR PHPOffice#455 was submitted by @Aketos in 2018. It added no unit tests, so it was not merged, and it eventually went stale. Without the tests, I'm not sure exactly what the user had in mind. But my investigation indicates the following: - for Xls files, if the column width in the file specifies a value greater than 255, Excel will choose its own width when it opens the file. - for Xlsx files: - Excel does not allow you to set a column width > 255, neither by dragging the column boundary, nor by right-clicking and setting a value, nor by auto-fitting the column width. - Nevertheless, if the XML specifies a column width > 255, Excel will honor that value in the displayed spreadsheet, and even write it out if the file is saved. I have taken a different approach than the original PR, which changed `Worksheet::calculateColumnWidths`. Instead, this PR adds an option to the Xlsx Writer to either restrict column widths to 255 or not. The default is "not" in order to avoid a breaking change. For emulating Excel's behavior, in the unusual situation where it might matter, the user might consider using the non-default option. This PR also restricts column dimension width to 255 when saving an Xls file.
|
Superseded by PR #4581. Removing stale label, leaving closed. |
This is:
Checklist:
Why this change is needed?
If the autoSize() calculate a width for a column superior to 255 (maximum Excel width column) the column size is set at minimum width instead of maximum