货币格式为excelJS
Currency format is excelJS
如何在 exceljs 中格式化货币?
我只从他们的文档中找到了这个...我不知道如何输入所以我粘贴了它,但它似乎不起作用
// Set Column 3 to Currency Format
ws.getColumn(3).numFmt = '�#,##0;[Red]-�#,##0';
只是做了一些修改。
ws.getColumn(3).numFmt = '$#,##0.00;[Red]-$#,##0.00';
# 是可选数字。如果您不关心负数是红色的,您可以将其保留为 $#,##0.00
对于完整的会计格式,例如 left-justified“$”、$-
表示 $0.00 等,您可以使用:
const numFmtStr = '_("$"* #,##0.00_);_("$"* (#,##0.00);_("$"* "-"??_);_(@_)';
cell.numFmt = numFmtStr;
参见:What are .NumberFormat Options In Excel VBA?
如何在 exceljs 中格式化货币?
我只从他们的文档中找到了这个...我不知道如何输入所以我粘贴了它,但它似乎不起作用
// Set Column 3 to Currency Format
ws.getColumn(3).numFmt = '�#,##0;[Red]-�#,##0';
只是做了一些修改。
ws.getColumn(3).numFmt = '$#,##0.00;[Red]-$#,##0.00';
# 是可选数字。如果您不关心负数是红色的,您可以将其保留为 $#,##0.00
对于完整的会计格式,例如 left-justified“$”、$-
表示 $0.00 等,您可以使用:
const numFmtStr = '_("$"* #,##0.00_);_("$"* (#,##0.00);_("$"* "-"??_);_(@_)';
cell.numFmt = numFmtStr;
参见:What are .NumberFormat Options In Excel VBA?