Open AndrewClose opened 4 weeks ago
I can’t check for a couple of weeks, but most of the tests use currency_code
as an argument as well. I don’t know if that will workaround what looks like a bug. You will need to use it anyway to get $ as the default is GBP. I don’t detect the locale currently so I just picked a default that matched mine.
Hi Jon,
Thanks for your response!
Yes, originally I had the “currency_code” argument in the Python statement (see below) but I took it out when reporting the bug to minimize the number of arguments that were changing between the “number” formatted statement and the “currency” formatted statement.
outputTable.set_cell_formatting(destRow, destCol, "currency", currency_code="CAD", decimal_places=0, show_thousands_separator=True, use_accounting_style=True)
The statement above provides the same results as the one reported. I’ve tried a variety of arguments. The statements below all yield the same incorrect result:
outputTable.set_cell_formatting(destRow, destCol, “currency", currency_code="USD”) outputTable.set_cell_formatting(destRow, destCol, "currency", currency_code="USD", decimal_places=0) outputTable.set_cell_formatting(destRow, destCol, "currency", currency_code="CAD", decimal_places=0, show_thousands_separator=True, use_accounting_style=True) outputTable.set_cell_formatting(destRow, destCol, "currency", show_thousands_separator=True, use_accounting_style=True, currency_code="USD", decimal_places=0)
Cheers! Andrew
On Aug 15, 2024, at 6:01 PM, Jon Connell @.***> wrote:
I can’t check for a couple of weeks, but most of the tests https://github.com/masaccio/numbers-parser/blob/main/tests/test_formatting.py use currency_code as an argument as well. I don’t know if that will workaround what looks like a bug. You will need to use it anyway to get $ as the default is GBP https://masaccio.github.io/numbers-parser/api/table.html#numbers_parser.Table.set_cell_formatting. I don’t detect the locale currently so I just picked a default that matched mine.
— Reply to this email directly, view it on GitHub https://github.com/masaccio/numbers-parser/issues/90#issuecomment-2292349781, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG5FCAUQFILT7T2KFREOIBDZRUQMPAVCNFSM6AAAAABMSIMKXCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOJSGM2DSNZYGE. You are receiving this because you authored the thread.
Should be fixed in v4.13.1
Describe the bug When I try to set a cell to the "currency" format with set_cell_formatting nothing happens.
To Reproduce I have a cell with the number 1769900.26 in it. I would like to format it as currency. If I execute the following line of python to format a cell as "currency": outputTable.set_cell_formatting(destRow, destCol, “currency”, decimal_places=0, show_thousands_separator=True) I get the following output: 1769900.26
However, to test if cell formatting in general is working, if I execute the following line of python to format a cell as a "number": outputTable.set_cell_formatting(destRow, destCol, "number", decimal_places=0, show_thousands_separator=True) I get the following output: 1,769,900
(All I changed in the Python code was "currency" to "number".
Expected behavior When I execute the line: outputTable.set_cell_formatting(destRow, destCol, “currency”, decimal_places=0, show_thousands_separator=True) I expect to get the following output: $1,769,900
However the result is 1769900.26 which is incorrect.
Formatting as a number works fine but formatting as currency does not do anything.
Additional information Numbers Version 14.1 Numbers Parser Version 4.12.2 macOS Version 14.6.1
Add any other context about the problem here.