Skip to content
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

feature request: add max_width for autofit #1106

Open
phikuh opened this issue Dec 17, 2024 · 1 comment
Open

feature request: add max_width for autofit #1106

phikuh opened this issue Dec 17, 2024 · 1 comment
Assignees
Labels
feature request short term Will be added. under investigation The issue is being investigated.

Comments

@phikuh
Copy link

phikuh commented Dec 17, 2024

Feature Request

When using the autofit method it'd be amazing if a maximum width for the columns could be specified instead of just the hardcoded 255.

# old
worksheet.autofit()

# new
worksheet.autofit(100) # max width of 100

worksheet.autofit(300) # uses 255 as max width and outputs a warning

I'm willing to submit a pull request if this feature is allowed to be implemented

@jmcnamara
Copy link
Owner

I got a similar request recently for the Rust version of this library: jmcnamara/rust_xlsxwriter#119

I handled that a bit differently by exposing the string calculation method. However your suggested approach of just setting a max width for all columns in the autofit range would probably be what 99% of users would need.

I'll put this on the short term todo list but let me look into how Excel handles auto fitting long strings first.

@jmcnamara jmcnamara self-assigned this Dec 17, 2024
@jmcnamara jmcnamara added short term Will be added. under investigation The issue is being investigated. labels Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request short term Will be added. under investigation The issue is being investigated.
Projects
None yet
Development

No branches or pull requests

2 participants