[]
• new CultureInfo()
Represents the custom culture class. The member variable can be overwritten.
• DateTimeFormat: IDateTimeFormat
Indicates the date time format fields.
property
{string[]} abbreviatedDayNames - Specifies the day formatter for "ddd".
property
{string[]} abbreviatedMonthGenitiveNames - Specifies the month formatter for "MMM".
property
{string[]} abbreviatedMonthNames - Specifies the month formatter for "MMM".
property
amDesignator - Indicates the AM designator.
property
{string[]} dayNames - Specifies the day formatter for "dddd".
property
fullDateTimePattern - Specifies the standard date formatter for "F".
property
longDatePattern - Specifies the standard date formatter for "D".
property
longTimePattern - Specifies the standard date formatter for "T" and "U".
property
monthDayPattern - Specifies the standard date formatter for "M" and "m".
property
{string[]} monthGenitiveNames - Specifies the formatter for "MMMM".
property
{string[]} monthNames - Specifies the formatter for "M" or "MM".
property
pmDesignator - Indicates the PM designator.
property
shortDatePattern - Specifies the standard date formatter for "d".
property
shortTimePattern - Specifies the standard date formatter for "t".
property
yearMonthPattern - Specifies the standard date formatter for "y" and "Y".
example
// This example creates a custom culture.
var myCulture = new GC.Spread.Common.CultureInfo();
myCulture.NumberFormat.currencySymbol = "\u20ac"
myCulture.NumberFormat.numberDecimalSeparator = ",";
myCulture.NumberFormat.numberGroupSeparator = ".";
myCulture.NumberFormat.arrayGroupSeparator = ";";
myCulture.NumberFormat.arrayListSeparator = "\\";
myCulture.NumberFormat.listSeparator = ";";
myCulture.DateTimeFormat.amDesignator = "";
myCulture.DateTimeFormat.pmDesignator = "";
myCulture.DateTimeFormat.abbreviatedMonthNames = ["Jan", "Feb", "Mrz", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez", ""];
myCulture.DateTimeFormat.abbreviatedDayNames = ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"];
myCulture.DateTimeFormat.abbreviatedMonthGenitiveNames = ["Jan", "Feb", "Mrz", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez", ""];
myCulture.DateTimeFormat.dayNames = ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"];
myCulture.DateTimeFormat.fullDateTimePattern = "dddd, d. MMMM yyyy HH:mm:ss";
myCulture.DateTimeFormat.longDatePattern = "dddd, d. MMMM yyyy";
myCulture.DateTimeFormat.longTimePattern = "HH:mm:ss";
myCulture.DateTimeFormat.monthDayPattern = "dd MMMM";
myCulture.DateTimeFormat.monthNames = ["Januar", "Februar", "M\xe4rz", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember", ""];
myCulture.DateTimeFormat.monthGenitiveNames = ["Januar", "Februar", "M\xe4rz", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember", ""];
myCulture.DateTimeFormat.shortDatePattern = "dd.MM.yyyy";
myCulture.DateTimeFormat.shortTimePattern = "HH:mm";
myCulture.DateTimeFormat.yearMonthPattern = "MMMM yyyy";
//add one culture
GC.Spread.Common.CultureManager.addCultureInfo("de-DE", myCulture);
//switch to "de-DE" culture
GC.Spread.Common.CultureManager.culture("de-DE");
var d = new Date();
//With culture
activeSheet.setValue(1, 0, new Date(d.setDate(d.getDate() + 1)));
activeSheet.getCell(1, 0).formatter("mmm");
var dvalue = 12345.6789;
activeSheet.setColumnWidth(0, 200);
activeSheet.setColumnWidth(1, 200);
activeSheet.setColumnWidth(2, 200);
activeSheet.setValue(0, 0, dvalue);
activeSheet.getCell(0, 0).formatter("###,###.00");
activeSheet.setValue(2, 0, new Date(d.setDate(d.getDate() + 1)));
//With culture
activeSheet.getCell(3, 0).formatter("yyyy/mmm/dddd");
activeSheet.setValue(3, 0, new Date());
• LocalNumberFormat: ILocalNumberFormat
indicates the local number format built.It's a map whose keys are number and values are formatString.
property
key - this property key is number, this property value is format string.
//this is an example.
var cultureInfo = new GC.Spread.Common.CultureInfo().
cultureInfo.LocalNumberFormat = {
14:"yyyy-mm-dd",
15:"yyyy/mm/dd"
}
• NumberFormat: INumberFormat
Indicates all the number format fields.
property
currencyDecimalSeparator - Indicates the currency decimal point.
property
currencyGroupSeparator - Indicates the currency thousand separator.
property
currencySymbol - Indicates the currency symbol.
property
numberDecimalSeparator - Indicates the decimal point.
property
numberGroupSeparator - Indicates the thousand separator.
property
listSeparator - Indicates the separator for function arguments in a formula.
property
arrayListSeparator - Indicates the separator for the constants in one row of an array constant in a formula.
property
arrayGroupSeparator - Indicates the separator for the array rows of an array constant in a formula.
property
dbNumber - Specifies the DBNumber characters.
The dbNumber object structure as follow:
{
1: {letters: ['\u5146', '\u5343', '\u767e', '\u5341', '\u4ebf', '\u5343', '\u767e', '\u5341', '\u4e07', '\u5343', '\u767e', '\u5341', ''], // \u5146\u5343\u767e\u5341\u4ebf\u5343\u767e\u5341\u4e07\u5343\u767e\u5341
numbers: ['\u25cb', '\u4e00', '\u4e8c', '\u4e09', '\u56db', '\u4e94', '\u516d', '\u4e03', '\u516b', '\u4e5d'] }, // \u25cb\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d
2: {letters: ['\u5146', '\u4edf', '\u4f70', '\u62fe', '\u4ebf', '\u4edf', '\u4f70', '\u62fe', '\u4e07', '\u4edf', '\u4f70', '\u62fe', ''], // \u5146\u4edf\u4f70\u62fe\u4ebf\u4edf\u4f70\u62fe\u4e07\u4edf\u4f70\u62fe
numbers: ['\u96f6', '\u58f9', '\u8d30', '\u53c1', '\u8086', '\u4f0d', '\u9646', '\u67d2', '\u634c', '\u7396']}, // \u96f6\u58f9\u8d30\u53c1\u8086\u4f0d\u9646\u67d2\u634c\u7396
3: {letters: null,
numbers: ['\uff10', '\uff11', '\uff12', '\uff13', '\uff14', '\uff15', '\uff16', '\uff17', '\uff18', '\uff19']} // \uff10\uff11\uff12\uff13\uff14\uff15\uff16\uff17\uff18\uff19
};
example
// This example creates a custom culture.
var myCulture = new GC.Spread.Common.CultureInfo();
myCulture.NumberFormat.currencySymbol = "\u20ac"
myCulture.NumberFormat.numberDecimalSeparator = ",";
myCulture.NumberFormat.numberGroupSeparator = ".";
myCulture.NumberFormat.arrayGroupSeparator = ";";
myCulture.NumberFormat.arrayListSeparator = "\\";
myCulture.NumberFormat.listSeparator = ";";
myCulture.DateTimeFormat.amDesignator = "";
myCulture.DateTimeFormat.pmDesignator = "";
myCulture.DateTimeFormat.abbreviatedMonthNames = ["Jan", "Feb", "Mrz", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez", ""];
myCulture.DateTimeFormat.abbreviatedDayNames = ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"];
myCulture.DateTimeFormat.abbreviatedMonthGenitiveNames = ["Jan", "Feb", "Mrz", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez", ""];
myCulture.DateTimeFormat.dayNames = ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"];
myCulture.DateTimeFormat.fullDateTimePattern = "dddd, d. MMMM yyyy HH:mm:ss";
myCulture.DateTimeFormat.longDatePattern = "dddd, d. MMMM yyyy";
myCulture.DateTimeFormat.longTimePattern = "HH:mm:ss";
myCulture.DateTimeFormat.monthDayPattern = "dd MMMM";
myCulture.DateTimeFormat.monthNames = ["Januar", "Februar", "M\xe4rz", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember", ""];
myCulture.DateTimeFormat.monthGenitiveNames = ["Januar", "Februar", "M\xe4rz", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember", ""];
myCulture.DateTimeFormat.shortDatePattern = "dd.MM.yyyy";
myCulture.DateTimeFormat.shortTimePattern = "HH:mm";
myCulture.DateTimeFormat.yearMonthPattern = "MMMM yyyy";
//add one culture
GC.Spread.Common.CultureManager.addCultureInfo("de-DE", myCulture);
//switch to "de-DE" culture
GC.Spread.Common.CultureManager.culture("de-DE");
var d = new Date();
//With culture
activeSheet.setValue(1, 0, new Date(d.setDate(d.getDate() + 1)));
activeSheet.getCell(1, 0).formatter("mmm");
var dvalue = 12345.6789;
activeSheet.setColumnWidth(0, 200);
activeSheet.setColumnWidth(1, 200);
activeSheet.setColumnWidth(2, 200);
activeSheet.setValue(0, 0, dvalue);
activeSheet.getCell(0, 0).formatter("###,###.00");
activeSheet.setValue(2, 0, new Date(d.setDate(d.getDate() + 1)));
//With culture
activeSheet.getCell(3, 0).formatter("yyyy/mmm/dddd");
activeSheet.setValue(3, 0, new Date());
• TextFormat: ITextFormat
Indicates the text format fields.
property
{string[]} lineBreakingChar - Specifies the characters can split up two lines. Default is [" ", "-"].
property
{string[]} lineBreakingForbidStart - Specifies the characters that are not allowed at the start of a breaking line.
property
{string[]} lineBreakingForbidEnd - Specifies the characters that are not allowed at the end of a breaking line.
property
lineBreakingStrategy - Specifies the function for word split.
example
// This example modify culture line breaking strategy.
var myCulture = GC.Spread.Common.CultureManager.getCultureInfo();
myCulture.TextFormat.lineBreakingChar = [" ", "+"]; // can line breaking when "+"
myCulture.TextFormat.lineBreakingForbidStart = ["\u300b"]; // the \u300bwon't be start of the breaking line
myCulture.TextFormat.lineBreakingForbidEnd = ["\u300a"]; // the \u300a won't be end of the breaking line
activeSheet.setValue(0, 0, "1. 1+2+3+4+5+6+7");
activeSheet.getCell(0, 0).wordWrap(true); // the "1. " won't be in a single line
activeSheet.setValue(1, 0, "\u300aabc\u300b\u300adef\u300b\u300aghk\u300b");
activeSheet.getCell(1, 0).wordWrap(true); // the\u300a \u300bwill looks better
• displayName: string
• id: number
The id can be used to specify CultureInfo in number format.
• predefinedFormats: IPredefinedFormats
▸ name(): string
Get the name of the CultureInfo, such as 'de-DE'.
string
The name of the CultureInfo //This example adds and gets a new CultureInfo let cultureInfo = new GC.Spread.Common.CultureInfo(); cultureInfo.id = 0x407; cultureInfo.NumberFormat.numberDecimalSeparator = ","; cultureInfo.NumberFormat.numberGroupSeparator = "."; cultureInfo.NumberFormat.listSeparator = ""; cultureInfo.name = function () { return "de-DE"; }; GC.Spread.Common.CultureManager.addCultureInfo(cultureInfo.name(), cultureInfo); console.log(cultureInfo === GC.Spread.Common.CultureManager.getCultureInfo("de-DE"));//output: true