spreadsheet icon indicating copy to clipboard operation
spreadsheet copied to clipboard

Percentage Formatting Issue in Excel

Open cprodhomme opened this issue 11 months ago • 4 comments

Screenshot:

Image

File :

20250228-mg-11-pdm25 (1).xls

Description:

There appears to be a formatting issue when viewing percentage values in certain versions of Excel using the Gem spreadsheet. Specifically, the issue arises starting from some rows onwards, where percentages are not displayed correctly.

Affected Version of Excel:

  • Microsoft® Excel® for Microsoft 365 MSO (Version 2502 Build 16.0.18526.20144) 32-bit (Windows)
  • Microsoft Excel for MacOS - version 16.79.2 (23112723)

Steps to Reproduce:

Generate a spreadsheet using the Gem spreadsheet with percentage values. Open the spreadsheet in the specified version of Excel. Notice that from a certain row, the percentage formatting fails. Expected Behavior:

Percentages should be consistently formatted across all rows in Excel without issues.

PERCENTAGE_FORMAT = '0%'
Spreadsheet::Format.new(
  number_format: PERCENTAGE_FORMAT
)

Actual Behavior:

The percentage formatting is incorrect starting from specific rows, as shown in the attached screenshot.

Additional Details:

The code simply loops over each row to apply formatting, so there’s no apparent reason for the formatting to start failing at certain points. This suggests an issue with the gem or its interaction with Excel.

Additional Information:

Any assistance or guidance on resolving this issue would be greatly appreciated.

Thank you!

cprodhomme avatar Mar 25 '25 11:03 cprodhomme

  1. did you test with LibreOffice?
  2. Can you share the script how you generate the XLS?

zdavatz avatar Mar 25 '25 12:03 zdavatz

There is no problem on LibreOffice. :/

There is a lot of code; I think it will be difficult to share the code and the data.

cprodhomme avatar Mar 25 '25 17:03 cprodhomme

I think this is a problem with specific binary formats of the office versions

zdavatz avatar Mar 25 '25 18:03 zdavatz