-
Notifications
You must be signed in to change notification settings - Fork 119
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
Setting "automatic" width of a column #25
Comments
I thought it'd be something wild, because office programs rely on font size to calculate column width, and it's quiet difficult to do it in Elixir (I guess we'd have to use Erlang's gs module, it wouldn't be super fast and it won't work without font files). But after making some research I found an option named |
If this can be done without measuring font, I think it's good, otherwise it's a bad idea. |
Well, yes and no. Option |
I really feel that measuring the text is really a bad idea as platforms have different font rendering, it would include a huge dependency, and it will be slow. I also think that this should be let to the library user. Imagine a column with 90% of items within 100px wide, but 10% above that, only the library user can decide if 100px is a good fit or not. If you have some code measuring text, I would include it in the README, and let people start from it. |
It seems like the width unit is the width of some letter in the default font. Some people on StackOverflow set the column width to the max cell length (in characters) in the column times 1.25. This isn't ideal, but neither is defaulting to the default column width. What about a method that uses this rough approximation to set the size of every column that doesn't have an explicitly set width? |
There is no need in this, just take a look at my first comment. Unfortunately I'm out of spare time right now and I didn't use Elixir for a while, so y'all are free to submit your own PRs |
This is more a question or maybe a suggestion for improvement.
Is it possible to set the column width to automatically adapt to the width of the content of the data in the cells? In Excel/LibreOffice you can easily adapt the width by double clicking the resize handle of the column but is there any way to programatically achieve this without a hardcoded width?
The text was updated successfully, but these errors were encountered: