XLSX-Workbook-Class
XLSX-Workbook-Class copied to clipboard
Issue with non-$ currency symbol
I found a couple of bugs when the Windows currency symbol is set to something other than $, such as €. First bug, in SaveVFPSettings:
*** DH 2022-08-29: fixed bug: use ", 1" to get the currency symbol
*** this.VFPSettings.Currency = SET("CURRENCY")
this.VFPSettings.Currency = SET("CURRENCY", 1)
Second bug: in several places in GetGridColumnFormat, it uses a hard-coded $ rather than the actual currency symbol:
- In the “CASE toColumn.Format = "$$" && Display floating currency symbol” section:
IF ',' $ toColumn.InputMask
*** DH 2022-08-29: use correct currency symbol
*** toColumn.FormatCode = '"$"#,##0' + IIF(lnLenDecPart=0, '', '.' + REPLICATE('0', lnLenDecPart)) && Change by Doug Hennig
toColumn.FormatCode = '"' + This.VFPSettings.Currency + '"#,##0' + IIF(lnLenDecPart=0, '', '.' + REPLICATE('0', lnLenDecPart)) && Change by Doug Hennig
ELSE
*** DH 2022-08-29: use correct currency symbol
*** toColumn.FormatCode = '"$"#0' + IIF(lnLenDecPart=0, '', '.' + REPLICATE('0', lnLenDecPart)) && Change by Doug Hennig
toColumn.FormatCode = '"' + This.VFPSettings.Currency + '"#0' + IIF(lnLenDecPart=0, '', '.' + REPLICATE('0', lnLenDecPart)) && Change by Doug Hennig
ENDIF
- In the “CASE toColumn.Format = "$" && Display fixed currency symbol” section:
IF ',' $ toColumn.InputMask
*** DH 2022-08-29: use correct currency symbol
*** toColumn.FormatCode = '_("$"* #,##0' + IIF(lnLenDecPart=0, '', '.' + REPLICATE('0', lnLenDecPart)) + '_)' && Change by Doug Hennig
toColumn.FormatCode = '_("' + This.VFPSettings.Currency + '"* #,##0' + IIF(lnLenDecPart=0, '', '.' + REPLICATE('0', lnLenDecPart)) + '_)' && Change by Doug Hennig
ELSE
*** DH 2022-08-29: use correct currency symbol
*** toColumn.FormatCode = '_("$"* #0' + IIF(lnLenDecPart=0, '', '.' + REPLICATE('0', lnLenDecPart)) + '_)' && Change by Doug Hennig
toColumn.FormatCode = '_("' + This.VFPSettings.Currency + '"* #0' + IIF(lnLenDecPart=0, '', '.' + REPLICATE('0', lnLenDecPart)) + '_)' && Change by Doug Hennig
ENDIF
- In the “ CASE toColumn.FieldType = "Y"” section:
*** DH 2022-08-29: use correct currency symbol
***lcDollarSign = IIF("$" $ toColumn.Format, ""$"", "")
lcDollarSign = IIF("$" $ toColumn.Format, """ + This.VFPSettings.Currency + """, "")