SpreadJS Documentation
NumberFormatType Enumeration
Represents the number format type.
Members
MemberDescription
DateTimeFormats the data using the date-time formatter.
GeneralFormats the data using the general formatter.
NumberFormats the data using the number formatter.
TextFormats the data using the text formatter.
Example
This example gets the format type.
var myCulture = new GcSpread.Sheets.CultureInfo();
myCulture.currencySymbol = "€"
myCulture.numberDecimalSeparator = ",";
myCulture.numberGroupSeparator = ".";
myCulture.arrayGroupSeparator = ";";
myCulture.arrayListSeparator = "\\";
myCulture.listSeparator = ";";
myCulture.amDesignator = "";
myCulture.pmDesignator = "";
myCulture.abbreviatedMonthNames = ["Jan","Feb","Mrz","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez",""];
myCulture.abbreviatedDayNames = ["So","Mo","Di","Mi","Do","Fr","Sa"];
myCulture.abbreviatedMonthGenitiveNames = ["So","Mo","Di","Mi","Do","Fr","Sa"];
myCulture.dayNames = ["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"];
myCulture.fullDateTimePattern = "dddd, d. MMMM yyyy HH:mm:ss";
myCulture.longDatePattern = "dddd, d. MMMM yyyy";
myCulture.longTimePattern = "HH:mm:ss";
myCulture.monthDayPattern = "dd MMMM";
myCulture.monthNames = ["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember",""];
myCulture.monthGenitiveNames = ["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember",""];
myCulture.shortDatePattern = "dd.MM.yyyy";
myCulture.shortTimePattern = "HH:mm";
myCulture.yearMonthPattern = "MMMM yyyy";
 
//add one culture
GcSpread.Sheets.addCultureInfo("de-DE", myCulture);
//switch to "de-DE" culture
GcSpread.Sheets.Culture("de-DE");
var d = new Date();
//With culture
activeSheet.setValue(1, 0, new Date(d.setDate(d.getDate()+1)));

gf1 = new GcSpread.Sheets.GeneralFormatter("F", GcSpread.Sheets.FormatMode.StandardDateTimeMode);
activeSheet.setFormatter(1, 0, gf1);
alert(gf1.GetFormatType(gf1));

var dvalue= 12345.6789;
var nvalue = 12345;
activeSheet.setColumnWidth(0, 100);
activeSheet.setColumnWidth(1, 100);
activeSheet.setColumnWidth(2, 100);
activeSheet.setValue(0,0,dvalue);

var gf = new GcSpread.Sheets.GeneralFormatter("c3", GcSpread.Sheets.FormatMode.StandardNumericMode);
activeSheet.getCell(0, 0).formatter(gf);
alert(gf.GetFormatType(gf));

//Without culture
activeSheet.setValue(2, 0, new Date(d.setDate(d.getDate() + 1)));
//With culture
activeSheet.setFormatter(3, 0, "yyyy/MMM/dddd");
activeSheet.setValue(3, 0, new Date());
Inheritance Hierarchy

Object
   GcSpread.Sheets.NumberFormatType

See Also

Reference

GcSpread.Sheets Namespace

 

 


Copyright © GrapeCity, inc. All rights reserved.

Send comments on this topic.