Could you please zip and attach your sample Excel file and give us column name/index to which you are trying to get width in pixels via the method. We will check it soon.
But one weird thing I just figured out.
When I create the groupping for the column, collapsed it first time and save the file, method Column.getWidth returns 0.0
Then I expand this grouping and collapse it again and save the file.
After that Column.getWidth returns the real column width before it’s been collapsed.
You can see it in the example file.
Column B was already collapsed, expanded and collapsed again, but column D was only collapsed once.
The result of my test is:
@nikiton
By using sample files and code for testing, we can reproduce the issue. Found getting an incorrect original width of a hidden column in pixels when calling Column.getWidth().
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): CELLSJAVA-45835
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
But my question was: is there any way to obtain a width (in pixels) of a hidden column, wich the column had before hiding? )
I believe it should be stored somewhere, because when we unhide a column, its width set not to default value, but to the value, that the column had before hiding.
@nikiton
You can use Cells.getColumns().get (index).getWidth() to obtain column width, but there are currently some issues with obtaining column width for hidden columns. We have created the ticket CELLSJAVA-45835 and hope to fix it soon. We will notify you immediately of any updates.
@nikiton
The column width is zero in the file: <col min="4" max="4" width="0" hidden="1" customWidth="1" outlineLevel="1"/>
Could you share a sample project to show how to group columns?
@nikiton
Thanks for further details. Let us investigate and analyze your issue in details. Hopefully we could figure it out soon. Once we have an update on it, we will let you know.
The width of column D is zero in the file, we only can return zero too.
About the columnd of Column B in unit of pixels, we will add an overloaded method
cells.GetColumnWidthPixel(column, original) to support your need in the next version 24.2