TreeGrid Exporting services
18 Sep 20179 minutes to read
Description
The following are the types of exporting is available in TreeGrid.
- PDF Export.
- Excel Export.
PDF Export
URL
http://js.syncfusion.com/demos/ejServices/api/JSTreeGridExport/PdfExport
Parameter
Type1:
Name | Type | Description |
TreeGridProperties | Object | It takes TreeGrid model properties that should be pass to exporting |
datasource | object | It holds the data to be exported in PDF |
TreeGridExportSettings | object | Returns the exporting settings like Unicode support, columns fit to width, hidden column, template, etc.. |
Type2:
Name | Type | Description |
TreeGridProperties | Object | It takes TreeGrid model properties that should be pass to exporting |
datasource | object | It holds the data to be exported in PDF |
TreeGridExportSettings | object | Returns the exporting settings like Unicode support, columns fit to width, hidden column, template, etc.. |
fileName | String | With this parameter you can set the downloaded file name. By default it is set to “Export” |
Type3:
Name | Type | Description |
TreeGridProperties | Object | It takes TreeGrid model properties that should be pass to exporting |
datasource | object | It holds the data to be exported in PDF |
TreeGridExportSettings | object | Returns the exporting settings like Unicode support, columns fit to width, hidden column, template, etc.. |
fileName | String | With this parameter you can set the downloaded file name. By default it is set to “Export” |
filePath | String | With this parameter you can set the location where the exporting file should downloaded. It can be local or server machine file path. |
Type4:
Name | Type | Description |
TreeGridProperties | Object | It takes TreeGrid model properties that should be pass to exporting |
datasource | object | It holds the data to be exported in PDF |
TreeGridExportSettings | object | Returns the exporting settings like Unicode support, columns fit to width, hidden column, template, etc.. |
exportToFile | Boolean | Is a Boolean argument, and value ‘true’ specifies the exporting is completed and download it, value ‘false’ specifies the export TreeGrid internally and append something else to it before download starts. |
headerText | String | HeaderText Is to specify the title for export document. |
Name | Type | Description |
TreeGridProperties | Object | It takes TreeGrid model properties that should be pass to exporting |
datasource | object | It holds the data to be exported in PDF |
TreeGridExportSettings | object | Returns the exporting settings like Unicode support, columns fit to width, hidden column, template, etc.. |
fileName | String | With this parameter you can set the downloaded file name. By default it is set to “Export” |
exportToFile | Boolean | Is a Boolean argument, and value ‘true’ specifies the exporting is completed and download it, value ‘false’ specifies the export TreeGrid internally and append something else to it before download starts. |
headerText | String | HeaderText Is to specify the title for export document. |
Type5:
Name | Type | Description |
TreeGridProperties | Object | It takes TreeGrid model properties that should be pass to exporting |
datasource | object | It holds the data to be exported in PDF |
TreeGridExportSettings | object | Returns the exporting settings like Unicode support, columns fit to width, hidden column, template, etc.. |
fileName | String | With this parameter you can set the downloaded file name. By default it is set to “Export” |
exportToFile | Boolean | Is a Boolean argument, and value ‘true’ specifies the exporting is completed and download it, value ‘false’ specifies the export TreeGrid internally and append something else to it before download starts. |
headerText | String | HeaderText Is to specify the title for export document. |
Type6:
Name | Type | Description |
TreeGridProperties | Object | It takes TreeGrid model properties that should be pass to exporting |
datasource | object | It holds the data to be exported in PDF |
TreeGridExportSettings | object | Returns the exporting settings like Unicode support, columns fit to width, hidden column, template, etc.. |
fileName | String | With this parameter you can set the downloaded file name. By default it is set to “Export” |
filePath | String | With this parameter you can set the location where the exporting file should downloaded. It can be local or server machine file path. |
exportToFile | Boolean | Is a Boolean argument, and value ‘true’ specifies the exporting is completed and download it, value ‘false’ specifies the export TreeGrid internally and append something else to it before download starts. |
headerText | String | HeaderText Is to specify the title for export document. |
Type7:
Name | Type | Description |
TreeGridProperties | Object | It takes TreeGrid model properties that should be pass to exporting |
datasource | object | It holds the data to be exported in PDF |
TreeGridExportSettings | object | Returns the exporting settings like Unicode support, columns fit to width, hidden column, template, etc.. |
Document | Object | It specifies in case of multiple exporting, in which document the file export should append, it holds the internally stored PDF files which is exported previously. |
exportToFile | Boolean | Is a Boolean argument, and value ‘true’ specifies the exporting is completed and download it, value ‘false’ specifies the export TreeGrid internally and append something else to it before download starts. |
headerText | String | HeaderText Is to specify the title for export document. |
Type8:
Name | Type | Description |
TreeGridProperties | Object | It takes TreeGrid model properties that should be pass to exporting |
datasource | object | It holds the data to be exported in PDF |
TreeGridExportSettings | object | Returns the exporting settings like Unicode support, columns fit to width, hidden column, template, etc.. |
Filename | string | With this parameter you can set the downloaded file name. By default it is set to “Export”. |
Document | Object | It specifies in case of multiple exporting, in which document the file export should append, it holds the internally stored PDF files which is exported previously. |
exportToFile | Boolean | Is a Boolean argument, and value ‘true’ specifies the exporting is completed and download it, value ‘false’ specifies the export TreeGrid internally and append something else to it before download starts. |
headerText | String | HeaderText Is to specify the title for export document. |
Type9:
Name | Type | Description |
TreeGridProperties | Object | It takes TreeGrid model properties that should be pass to exporting |
datasource | object | It holds the data to be exported in PDF |
TreeGridExportSettings | object | Returns the exporting settings like Unicode support, columns fit to width, hidden column, template, etc.. |
Filename | string | With this parameter you can set the downloaded file name. By default it is set to “Export”. |
filePath | String | With this parameter you can set the location where the exporting file should downloaded. It can be local or server machine file path. |
Document | Object | It specifies in case of multiple exporting, in which document the file export should append, it holds the internally stored PDF files which is exported previously. |
exportToFile | Boolean | Is a Boolean argument, and value ‘true’ specifies the exporting is completed and download it, value ‘false’ specifies the export TreeGrid internally and append something else to it before download starts. |
headerText | String | HeaderText Is to specify the title for export document. |
Request
<ej-treegrid id="TreeGridControl" (toolbarClick)="toolbarClick($event)"
//...>
</ej-treegrid>
import {Component} from '@angular/core';
@Component({
selector: 'ej-app',
templateUrl: 'app/app.component.html'
})
export class AppComponent {
public contextMenuSettings: any;
constructor() {
//...
this.contextMenuSettings = {
showContextMenu: true
contextMenuItems: ["add", "edit", "delete"]
}
}
toolbarClick(sender) {
var TreeGridObj = $("#TreeGridControl").data("ejTreeGrid");
TreeGridObj.exportGrid = TreeGridObj["export"];
if (sender.itemName == "PDF Export") {
TreeGridObj.exportGrid('http://js.syncfusion.com/ejServices/api/JSTreeGridExport/PdfExport/api/JSTreeGridExport/PdfExport', "", false);
sender.cancel = true;
}
}
}
Following example will take part in the project service
public void PdfExport()
{
string gridModel = HttpContext.Current.Request.Params["TreeGridModel"];
TreeGridProperties gridProperty = ConvertGridObject(gridModel);
PdfExport exp = new PdfExport();
TaskDetailsCollection tc = new TaskDetailsCollection();
IEnumerable<TaskDetails> result = tc.GetDataSource(); // datasource to be exported
TreeGridExportSettings settings = new TreeGridExportSettings();
settings.Theme = ExportTheme.FlatAzure;
exp.Export(gridProperty, result, settings, "Export");
}
Excel export
URL
http://js.syncfusion.com/ejServices/api/JSTreeGridExport/ExcelExport
Parameter
Type1:
Name | Type | Description |
TreeGridProperties | Object | It takes TreeGrid model properties that should be pass to exporting |
datasource | object | It holds the data to be exported in PDF |
excelName | String | It specifies the file extension to be downloaded |
excelVersion | String | Excel version in which document should download |
TreeGridExportSettings | object | Returns the exporting settings like Unicode support, columns fit to width, hidden column, template, etc.. |
Type2:
Name | Type | Description |
TreeGridProperties | Object | It takes TreeGrid model properties that should be pass to exporting |
datasource | object | It holds the data to be exported in PDF |
excelName | String | It specifies the file extension to be downloaded |
excelVersion | String | Excel version in which document should download |
TreeGridExportSettings | object | Returns the exporting settings like Unicode support, columns fit to width, hidden column, template, etc.. |
fileName | String | With this parameter you can set the downloaded file name. By default it is set to “ExcelExport” |
Type3:
Name | Type | Description |
TreeGridProperties | Object | It takes TreeGrid model properties that should be pass to exporting |
datasource | object | It holds the data to be exported in PDF |
excelName | String | It specifies the file extension to be downloaded |
excelVersion | String | Excel version in which document should download |
TreeGridExportSettings | object | Returns the exporting settings like Unicode support, columns fit to width, hidden column, template, etc.. |
isLocalSave | Boolean | It specifies the file have to save locally or can export directly in case of multiple export. |
filePath | String | With this parameter you can set the location where the exporting file should downloaded. It can be local or server machine file path. |
Request
<ej-treegrid id="TreeGridControl" (toolbarClick)="toolbarClick($event)"
//...>
</ej-treegrid>
import {Component} from '@angular/core';
@Component({
selector: 'ej-app',
templateUrl: 'app/app.component.html'
})
export class AppComponent {
public contextMenuSettings: any;
constructor() {
//...
this.contextMenuSettings = {
showContextMenu: true
contextMenuItems: ["add", "edit", "delete"]
}
}
toolbarClick(sender) {
var TreeGridObj = $("#TreeGridControl").data("ejTreeGrid");
TreeGridObj.exportGrid = TreeGridObj["export"];
if (sender.itemName == "Excel Export") {
TreeGridObj.exportGrid('http://js.syncfusion.com/ejServices/api/JSTreeGridExport/ExcelExport', "", false);
sender.cancel = true;
}
}
}
Following example will take part in the project service
public void ExcelExport()
{
string gridModel = HttpContext.Current.Request.Params["TreeGridModel"];
TreeGridProperties gridProperty = ConvertGridObject(gridModel);
ExcelExport exp = new ExcelExport();
TaskDetailsCollection tc = new TaskDetailsCollection();
IEnumerable<TaskDetails> result = tc.GetDataSource();
exp.Export(gridProperty, result, "ExcelExport.xlsx", ExcelVersion.Excel2010, new TreeGridExportSettings() { Theme = ExportTheme.FlatAzure });
}