SpreadSheet data can be exported to Excel, PDF, CSV, and PNG formats. Call the corresponding method: toPDF, toPNG, toExcel, or toCSV to export data from SpreadSheet into the file of the necessary format. For example, for Excel:
webix.ui({
id:"ss1",
view:"spreadsheet",
data: sheet1_data
});
webix.toExcel("ss1");
By default, SpreadSheet data is exported to any format with the following settings:
You can change this behavior by specifying the desired settings as an object in the second parameter of the export methods. For example:
webix.toExcel("ss1", options);
Related sample: Export to .xlsx, .pdf and .png
SpreadSheet a range of settings for exporting data into an Excel file.
You need to set the math:true property in the second parameter of the toExcel method.
webix.toExcel($$("ss1"),{ math:true});
Spreadsheet supports sheet-specific named ranges only, global named ranges will not be exported.
The styles are exported by default. If you do not want to, set the styles option to false in the second parameter of the toExcel method.
webix.toExcel($$("ss1"), { styles:true });
The spans are exported by default. If you do not want to, set the spans:false property in the second parameter of the toExcel method:
webix.toExcel($$("ss1"), { spans:true });
This setting is set to false by default and can take the following values:
webix.toExcel($$("ss1"), {
heights:true
});
In case the styles:true option is set, the heights option is automatically set to "all".
By default, Spreadsheet exports the currently active sheet to an Excel file. You can have three more possible options:
1) to export all the sheets, set the sheets:true option in the second parameter of the toExcel method:
webix.toExcel($$("ss1"), { sheets:true });
2) to export separate sheets, set an array with sheets ids as a value of the sheets option:
webix.toExcel($$("ss1"), { sheets:[ "s1","s2" ] });
3) to export a certain sheet, set its id as a value of the sheets option:
webix.toExcel($$("ss1"),{sheets:"s2"});
By default the header of a sheet is not exported. To export the content of a header, you need to use the header option and set it to true:
webix.toExcel($$("ss1"), {
header:true
});
You can export SpreadSheet data offline. To enable this possibility, you should follow the common way for all data components.
Back to top