Importing service
Description
To import an excel file in Spreadsheet by using import service.
NOTE
allowImport
must be true.
URL
http://js.syncfusion.com/demos/ejservices/api/JSXLExport/Import
Parameter
Name | DataType | Description |
---|---|---|
File | HttpPostedFileBase | To specify the excel file. |
Url | String | To specify the URL of the online files which is imported to the spreadsheet. |
AllowSheetOnDemand | Boolean | To specify the a value indicating whether the sheet on demand is enable or not. |
Password | String | To specify the password for the protected import file. |
Request
<div id=”Spreadsheet”></div>
var Spreadsheet = $("#Spreadsheet").data("ejSpreadsheet");// Spreadsheet Object
var importSettings = Spreadsheet.model.importSettings;
importSettings.allowImport = true;
importSettings.importMapper = "http://js.syncfusion.com/demos/ejservices/api/JSXLExport/Import";
importSettings.importUrl = "http://mvc.syncfusion.com/Spreadsheet/LargeData.xlsx";
importSettings.allowSheetOnDemand = false;
importSettings.password = "";
Spreadsheet.import({ url:importSettings.importUrl, allowSheetOnDemand:importSettings.allowSheetOnDemand });
Response (JSON)
Excel file document which is imported in spreadsheet.
Exporting service
Description
The following exporting options are available in Spreadsheet.
- Excel Export
- CSV Export
- PDF Export
NOTE
allowExporting
must be true.
Excel Export
Description
To export spreadsheet data as Excel document.
URL
http://js.syncfusion.com/demos/ejservices/api/JSXLExport/ExportToExcel
Parameter
Name | DataType | Description |
---|---|---|
type | Enum | To specify the type of the file to be downloaded (XLSX, XLS). |
Password | String | To set the password for the file to be downloaded |
Request
<div id=”Spreadsheet”></div>
var Spreadsheet = $("#Spreadsheet").data("ejSpreadsheet");// Spreadsheet Object
var exportSettings = Spreadsheet.model.exportSettings;
exportSettings.allowExporting = true;
exportSettings.excelUrl = "http://js.syncfusion.com/demos/ejservices/api/JSXLExport/ExportToExcel";
exportSettings.password = "";
Spreadsheet.XLExport.export("Excel");
Response
Code: 200
Content-Type: application/octet-stream
Response (XLSX,XLS)
Browser will prompt a dialog box to save the file (document).
CSV Export
Description
To export spreadsheet data as CSV document.
URL
http://js.syncfusion.com/demos/ejservices/api/JSXLExport/ExportToCsv
Parameter
Name | DataType | Description |
---|---|---|
Type | Enum | To specify the type of the file to be downloaded (CSV). |
Password | String | To set the password for the file to be downloaded |
Request
<div id=”Spreadsheet”></div>
var Spreadsheet = $("#Spreadsheet").data("ejSpreadsheet");// Spreadsheet Object
var exportSettings = Spreadsheet.model.exportSettings;
exportSettings.allowExporting = true;
exportSettings.csvUrl = "http://js.syncfusion.com/demos/ejservices/api/JSXLExport/ExportToCsv";
exportSettings.password = "";
Spreadsheet.XLExport.export("Csv");
Response
Code: 200
Content-Type: application/octet-stream
Response (CSV):
Browser will prompt a dialog box to save the file (document).
PDF Export
Description
To export spreadsheet data as PDF document.
URL
http://js.syncfusion.com/demos/ejservices/api/JSXLExport/ExportToPdf
Parameter
Name | DataType | Description |
---|---|---|
type | Enum | To specify the type of the file to be downloaded (PDF). |
Password | String | To set the password for the file to be downloaded |
Request
<div id=”Spreadsheet”></div>
var Spreadsheet = $("#Spreadsheet").data("ejSpreadsheet");// Spreadsheet Object
var exportSettings = Spreadsheet.model.exportSettings;
exportSettings.allowExporting = true;
exportSettings.pdfUrl = "http://js.syncfusion.com/demos/ejservices/api/JSXLExport/ExportToPdf";
exportSettings.password = "";
Spreadsheet.XLExport.export("Pdf");
Response
Code: 200
Content-Type: application/octet-stream
Response (PDF)
Browser will prompt a dialog box to save the file (document).