You can format cell values using standard number, date time, and custom formats. You can also set the culture to 你可以使用数字,日期或者自定义格式来格式化单元格。
你也可以将单元格的 culture 设置成 "ja-jp" or 或者 "en-us".Numbers are formatted based on the current culture. The default culture is English. You can set the culture to 。
数字会基于当前的 culture 进行格式化。默认为 English。
你可以将 culture 设置为 "ja-jp" or 或者 "en-us". You can specify the culture for the widget or individual cells. The cell culture does not change the widget culture.。
你可以只给整个控件设置 culture,也可以给某个单元格设置 culture。
单元格的 culture 不会影响控件的 culture。
Spread.Sheets 支持普通分数格式,比如 "# ?/?","# ??/??","# ?/4"和"#,## ?/?"。
你可以将负数转换成分数格式,
Spread.Sheets supports common fraction formats, such as "# ?/?", "# ??/??", "# ?/4", and "#,## ?/?". You can convert a negative value to a fraction. Spread.Sheets also supports the local ID "$-411" and DBNumber.
...
For more information on number format codes, refer to http://msdn.microsoft.com/en-us/library/dwhawy9k.aspx.
Using Code
This example formats cell values.
JavaScript | Copy Code |
---|---|
var dvalue= 12345.6789; activeSheet.setValue(0,0,dvalue); activeSheet.getCell(0, 1).formatter("M"); activeSheet.setValue(0, 1, new Date(2011, 2, 9)); activeSheet.getCell(0, 2).formatter("m"); activeSheet.setValue(0, 2, new Date(2012, 10, 15)); activeSheet.getCell(0, 3).formatter("General"); activeSheet.setValue(0, 3, new Date(2012, 10, 15)); activeSheet.getCell(0, 4).formatter("#.#%"); activeSheet.setValue(0, 4, 1); activeSheet.getCell(1, 0).formatter("[>2]0.0;[<-3]0.0;zero;"); activeSheet.setValue(1, 0, 3); |
Using Code
This example formats a cell value as a fraction.
JavaScript | Copy Code |
---|---|
var dvalue= 123.89; activeSheet.setValue(0,0,dvalue); activeSheet.getCell(0, 0).formatter("# ??/??"); |
Using Code
This example formats a cell value using locale ID "$-411".
JavaScript | Copy Code |
---|---|
var dvalue= 123.89; activeSheet.setValue(0,0,dvalue); activeSheet.getCell(0,0).formatter("[$-411]dddd"); |
Using Code
This example formats a cell value using DBNumber.
JavaScript | Copy Code |
---|---|
var dvalue= 123.89; activeSheet.setValue(0,0,dvalue); activeSheet.getCell(0,0).formatter("[DBNum2][$-411]General"); |
Using Code
This example sets the culture for the widget.
JavaScript | Copy Code |
---|---|
//widget setting GC.Spread.Common.CultureManager.culture("ja-jp"); |
Using Code
This example sets the culture for the cell.
...