-
Notifications
You must be signed in to change notification settings - Fork 284
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 width optimization doesn't work without calling "calculate_column_widths" #1095
Comments
Yes this feature was changed few years ago, I can't say how it was working before that change, what was done and why, so I trust you. Do you think you can propose a fix/pull request? Thank you. |
NB: there is this discussion how it works now, especially code and demo program (in my comment): #646 |
Unfortunately I can't support at the moment due to our infrastructure. I don't e. g. have a connection to github via abapGit. Currently I'm also not that familiar with abab2xlsx and I don't know your deploying process (how to test ...). If I could get some help, maybe I'm able to contribute in the future ... |
Thanks, no problem, just asking for help :) If in the future you have the possibility to contribute, we'll try to help our best. |
I ran into the same problem doing following works, DO lo_worksheet->get_highest_column( ) TIMES.
lo_worksheet->get_column( zcl_excel_common=>convert_column2alpha( sy-index ) )->set_auto_size( abap_true ).
ENDDO.
lo_worksheet->calculate_column_widths( ). |
In former versions (I can't tell exactly, it seems to have been installed in 2014) of abap2xlsx it used to work calling "set_auto_size" on the object "ColumnDimension":
![1](https://user-images.githubusercontent.com/44520601/226588082-00ab44fd-7919-40dd-8c81-06968b2cc35f.png)
In newer version (installed in november 22) column optimization has to be done on a column object e. g. by using a column iterator.
![2](https://user-images.githubusercontent.com/44520601/226598952-004954a3-4048-434f-bb05-156b6d3c8766.png)
But in comparison to the former version, column width optimization does not work without explicitly calling "calculate_column_widths" (worksheet object).
I also checked some example programs e. g. ZDEMO_TECHED9. "calculate_column_widths" is not called within this program and as a result the generated Excel file doesn't have optimized columns.
In my opinion "calculate_column_widths" should be called internally before generating an Excel file if at least one column has the autosize property set.
The text was updated successfully, but these errors were encountered: