简体   繁体   English

格式范围为货币 - Excel Javascript

[英]Format Range as Currency - Excel Javascript

I'm trying to format a cell as Currency via Excel JavaScript API. I've tried currency and $ but neither work.我正在尝试通过 Excel JavaScript API 将单元格格式化为货币。我试过currency$但都不起作用。

What do I need to do?我需要做什么?

var Rev_Rng = ws.getRangeByIndexes(2, Header_Arr.indexOf("Est. Revenue"), Used_Rng_And_Props.rowCount - 2, 1)
Rev_Rng.select()
await context.sync()
Rev_Rng.numberFormat = '$'; //This just inserted '$' as the value I also tried 'currency'

Try to use something like that for the currency format:尝试对货币格式使用类似的东西:

"$#,###.00"

See Number format codes for more information.有关详细信息,请参阅数字格式代码

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM