我使用電子表格寶石來創建Excel表格。 如何將「貨幣」數字格式應用於特定單元格?貨幣數字格式使用電子表格寶石
4
A
回答
3
沒有嘗試過了,但也許下面將指向你在正確的方向:
nb_format = Spreadsheet::Format.new :number_format => '$#,###.##'
cell.set_format(0, nb_format)
1
如果你想使用Excel內置的貨幣格式中的一種,一個黑客是使用Excel格式化一個電子表格單元格(比如第1行,列A),並帶有您想要的格式。保存它,然後使用Excel給出該單元格的spreadsheet gem至read the format。在我的情況下,我得到_([$$-409]* #,##0.00_);_([$$-409]* \\(#,##0.00\\);_([$$-409]* \"-\"??_);_(@_)
作爲美元的格式。然後就可以用它像這樣:
currency_format = Spreadsheet::Format.new number_format: "_([$$-409]* #,##0.00_);_([$$-409]* \\(#,##0.00\\);_([$$-409]* \"-\"??_);_(@_)"
sheet.row(r).set_format(col, currency_format)
相關問題
- 1. 電子表格寶石
- 2. PHP數字格式(貨幣)
- 3. 未格式化貨幣格式貨幣
- 4. 錯誤使用電子表格寶石
- 5. 數/貨幣格式
- 6. 紅寶石的電子表格格式字符串
- 7. 貨幣的數據表格格式
- 8. 如何格式化通過紅寶石寶石電子表格單元格?
- 9. 格式貨幣
- 10. 貨幣格式
- 11. 貨幣格式
- 12. 用PHP打印貨幣數字格式
- 13. 格式字符串貨幣
- 14. 格式字符串數字到貨幣
- 15. 數字格式化函數值(貨幣)
- 16. 設置貨幣與表格選擇與錢寶石
- 17. 貨幣格式數VB.NET
- 18. Sencha貨幣格式
- 19. 貨幣格式C++
- 20. C#貨幣格式
- 21. C#格式貨幣
- 22. Javascript貨幣格式
- 23. 格式化貨幣
- 24. 格式化貨幣
- 25. ZF2貨幣格式
- 26. 貨幣laravel格式
- 27. 貨幣格式laravel
- 28. 格式化貨幣
- 29. INR貨幣格式
- 30. PHP貨幣格式
currency_format =電子表格:: Format.new:number_format => '$#,## 0.00 _); [紅色]($#,## 0.00)' 片.row(index).set_format(5,currency_format) 這對我更好。 – 2012-04-02 11:10:54