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

Column autofit #49

Open
BorjaRRR opened this issue Jul 31, 2023 · 3 comments
Open

Column autofit #49

BorjaRRR opened this issue Jul 31, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@BorjaRRR
Copy link

Can i do column autofit?

@mbleron mbleron added the enhancement New feature or request label Jul 31, 2023
@mbleron
Copy link
Owner

mbleron commented Jul 31, 2023

It's not possible at the moment.
The best you can do is set column width individually via setColumnProperties.

Note that Autofit is a complex operation, requiring the knowledge of font metrics, and building the whole dataset in memory in order to compute the max string size for each column.

I'll keep this issue open as an enhancement. I may implement something for the default font in the future.

@BorjaRRR
Copy link
Author

BorjaRRR commented Aug 1, 2023

Ok I understand. Excellent work, by the way.

@wickyhu
Copy link

wickyhu commented Dec 15, 2023

@mbleron
Hi, how about to consider a setting of default column width, by column type (and width maybe)?

Below just a simple rough thought for example:

  1. char/varchar related: if column data length<=50 then C1 else C2
  2. date/timestamp: default to D
  3. numeric related: if value <= 10000000 then N1 else N2
  4. others: default to O

I think a kind of default column width setting may meet 90% cases,
then we can set specific column width by setColumnProperties only when it's needed.

Regards
Wicky

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants