Maintaining Currency Format in Exported Excel

Answered
Amogh Arsekar asked on October 4, 2024

Hello,

I noticed that the currency format is not maintained in the exported excel. For example, if the flexmonster grid shows 48,523,389.00 in a cell, it changes to 4,85,23,389.00 in the exported excel. Is there a way to enforce a format and prevent it from changing when the grid is exported? I suspect Microsoft Excel is picking up the formatting based on some default but it would be great if I can prevent it by enforcing a format.

6 answers

Public
Maksym Diachenko Maksym Diachenko Flexmonster October 4, 2024

Hello, Amogh!

Thank you for writing to us.

As you mentioned, the issue with the number format in the exported Excel files is caused by regional formatting settings. Excel applies formatting based on the system locale, which can lead to differences in number representation. The format used in Flexmonster cannot be enforced for Excel, and you can only set it in Excel settings, as described in this guide: https://support.microsoft.com/en-us/office/change-the-character-used-to-separate-thousands-or-decimals-c093b545-71cb-4903-b205-aebb9837bd1e

Please let us know if this solution works for you.

Best Regards,
Maksym

Public
Amogh Arsekar November 8, 2024

Hello,

I understand that Flexmonster doesn't enforce the format in the exported Excel file. But is there a way to change the locale format used in the pivot grid? I checked that the formatObject for number formatting only allows me to change the currency symbol, negative symbol and seperators but doesn't allow me to configure how those seperators are placed. For example, for the US I would use Millions (1,000,000) but for India I would use Lakhs (10,00,000). Is there a way to configure this?

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster November 11, 2024

Hello, Amogh!

Thank you for writing to us.

Currently, Flexmonster's number formatting does not support Lakhs. However, you can use the customizeCell method to format numbers using JavaScript's locale formatting tools, which will add the separators accordingly to the chosen locale. Please check the following example: https://jsfiddle.net/flexmonster/robht7ef/
However, note that the values changed with the customizeCell would be exported as strings to Excel.

Please let us know if the suggested solution works for you.

Best Regards,
Nadia

Public
Maksym Diachenko Maksym Diachenko Flexmonster 4 days ago

Hello, Amogh!

Hope you are doing well.
We are wondering if you had time to check the suggested workaround for applying a Lakh format to numeric cells.
Please let us know if it works for you.

Best Regards,
Maksym

Public
Amogh Arsekar 4 days ago

Hello,

I am unable to use this workaround since the values changed with customizeCell are exported as strings and we require them to be formatted numbers so that users can perform calculations in the generated excel.

I would really appreciate if you can let me know if there are any plans to add support for Vedic number format to Flexmonster. It is a necessity for all our Indian clients.

Thanks

Public
Maksym Diachenko Maksym Diachenko Flexmonster 3 days ago

Hello, Amogh!

Thank you for your reply.

To address this issue, you can customize the export process using the exportTo API call. In this method, you can set the useCustomizeCellForData parameter as false to ignore the custom Lakh formatting applied with the customizeCell. This approach would allow the compromise scenario when:

  1. Numbers are formatted as Lakhs in Flexmonster.
  2. When exported to Excel, numeric data will be recognized as numbers, and it would be possible to format them as Lakhs.

Additionally, you can customize the toolbar to overwrite the default export handler and use the modified export.
Check the JSFiddle sample illustrating this approach: https://jsfiddle.net/flexmonster/946gf3y1/

Please let us know if this solution would work for you.

Best Regards,
Maksym

Please login or Register to Submit Answer