[]
Excel.IO
• new IO()
Represents an excel import and export class.
▪ Static
pivotTableThemes: Object
Build in pivot table themes.
▪ [key: string
]: any
▪ Static
slicerStyles: Object
Build in item slicer themes.
▪ [key: string
]: any
▪ Static
tableThemes: Object
Build in table themes.
▪ [key: string
]: any
▪ Static
timelineStyles: Object
Build in timeline slicer themes.
▪ [key: string
]: any
▸ open(file
, successCallBack
, errorCallBack?
, options?
): void
Imports an excel file.
example
var workbook = new GC.Spread.Sheets.Workbook(document.getElementById("ss"));
var excelIO = new GC.Spread.Excel.IO();
var excelFile = document.getElementById("fileDemo").files[0];
excelIO.open(excelFile, function (json) {
workbook.fromJSON(json);
}, function (e) {
console.log(e);
}, {
password: "password",
importPictureAsFloatingObject: false
});
Name | Type | Description |
---|---|---|
file |
Blob |
The excel file. |
successCallBack |
Function |
Call this function after successfully loading the file. function (json) { } . |
errorCallBack? |
Function |
Call this function if an error occurs. The exception parameter object structure { errorCode: GC.Spread.Excel.IO.ErrorCode, errorMessage: string} . |
options? |
OpenOptions |
The options for import excel. |
void
▸ registerMaxDigitWidth(fontFamily
, fontSize
, maxDigitWidth
): void
Register a unknown max digit width info to ExcelIO.
example
GC.Spread.Excel.IO.registerMaxDigitWidth("\ub3cb\uc6c0", 11, Math.floor(80/8.11));
Name | Type | Description |
---|---|---|
fontFamily |
string |
The font family of default style's font. |
fontSize |
number |
The font size of default style's font(in point). |
maxDigitWidth |
number |
The max digit width of default style's font. |
void
▸ save(json
, successCallBack
, errorCallBack?
, options?
): void
Creates and saves an excel file with the SpreadJS json.
example
var workbook = new GC.Spread.Sheets.Workbook(document.getElementById("ss"));
var excelIO = new GC.Spread.Excel.IO();
var json = JSON.stringify(workbook.toJSON());
excelIO.save(json, function (blob) {
saveAs(blob, fileName); //saveAs is from FileSaver.
}, function (e) {
console.log(e);
}, {
password: "password",
xlsxStrictMode: false
});
Name | Type | Description |
---|---|---|
json |
string | object |
The spread sheets json object, or string. |
successCallBack |
Function |
Call this function after successfully exporting the file. function (blob) { } . |
errorCallBack? |
Function |
Call this function if an error occurs. The exception parameter object structure { errorCode: GC.Spread.Excel.IO.ErrorCode, errorMessage: string} . |
options? |
SaveOptions |
The options for export excel. |
void