Creating this issue as a placeholder to enhance the Best fit calculation for column widths. The below came from Issue #90 by ARuddOS:
I have had a look at the code in the CalcBestFit procedure on release 50 and I can see what the underlying issue is. Line 20 is referencing xl_cells.cellvalue which is the data that is written to the cell, not what will be displayed in the cell.
In the example below autofit will work on 1,1 because xl_cells.cellvalue=Hi and the display will be Hi. 2,1 has xl_cells.cellvalue=10000 but the display is 10000.00 so the width calculated will be too short. 3,1 has xl_cells.cellvalue=45847 but the display is 09/07/2025 (British date layout!) so the width calculated will be too short.
It would need a whole new function to convert cellvalue to display value based on the format for that cell.
Creating this issue as a placeholder to enhance the Best fit calculation for column widths. The below came from Issue #90 by ARuddOS:
I have had a look at the code in the CalcBestFit procedure on release 50 and I can see what the underlying issue is. Line 20 is referencing xl_cells.cellvalue which is the data that is written to the cell, not what will be displayed in the cell.
In the example below autofit will work on 1,1 because xl_cells.cellvalue=Hi and the display will be Hi. 2,1 has xl_cells.cellvalue=10000 but the display is 10000.00 so the width calculated will be too short. 3,1 has xl_cells.cellvalue=45847 but the display is 09/07/2025 (British date layout!) so the width calculated will be too short.
It would need a whole new function to convert cellvalue to display value based on the format for that cell.