Skip to main content Skip to footer

Getting started with C1ASP.NET Export Services

Export capabilities are a great feature for any grid or chart, and it is a common requirement to use the data or visualization from these controls in reports. ComponentOne ASP.NET Wijmo has an export service which caters to this requirement for ASP.NET Wijmo Controls and widgets. This service is available with the Studio ASP.NET Wijmo installer as well as the Enterprise\Ultimate installers. When you are using the Wijmo widgets you can take advantage of the service with the Enterprise version. The general requirement of the service is as below:

  • Microsoft Windows 7: IIS 7.0 or higher with ASP.NET 4.0 (.NET framework 4.0).
  • Microsoft Windows 8: IIS 7.0 or higher with ASP.NET 4.5 (.NET framework 4.0).

Note: You may update .NET framework 4.0 in Microsoft Windows 7 or Microsoft Windows Server 2008 R2. See http://support.microsoft.com/kb/2468871, for more information. When you install Studio for ASP.NET Wijmo, the service installer can be located at C:\Program Files (x86)\ComponentOne\Studio for ASP.NET Wijmo as shown:

servicelinstaller

Let's install the service and inspect it's working. Double click the installer to start installation. You should get the following screen. installer1 Click Next. installer2 Click Install. The installer starts the installation, and then you should get the license activation as illustrated below: installer3 Enter the information and a serial number and then click next. This should activate the license for the service. After activation, click finish on the installer screen to complete the installation. installer4 The service is installed and a "C1ASPNETExportService" node is create in IIS.

serviceiis

Right click on the "C1ASPNETExportService" nodeand click explore. You should be able to see the service binaries at C:\ProgramData\ComponentOne\C1ASPNET\C1APNETExportService as shown below:

servicelocation

The "C1ASPNETExportService" is a WEB API, you can use this service to export C1GridView\Wijgrid to XLS\PDF\CSV and Charts\wijcharts to various image formats and PDF. Let's take a look on how to export a C1GridView using client side methods: The C1GridView has "exportGrid" client side method to export the grid, to export, it calls "exportapi/grid" api of the service to export, here is a script that exports the grid on click of a button to Excel: [javascript]<script type="text/javascript"> $(function () { $("#Button1").click(exportExcel); }); function exportExcel() { var fileName = "ExportedGrid"; var type = "Xls"; var excelSetting = { showGridLines: true, autoRowHeight: true, author: "GrapeCity" }; var url = "http://demos.componentone.com/ASPNET/ExportService" + "/exportapi/grid"; $("#<%=C1GridView1.ClientID%>").c1gridview("exportGrid", fileName, type, excelSetting, url); } </script>[/javascript] As you can see I passed five parameters to the export service, the method name , the exported filename, the type XLS\PDF\CSV, settings for the grid and the service URL. Similarly, we export chart to PNG using the "exportChart" method as shown in the below script on a click of a button at client side: [javascript] <script type="text/javascript"> $(function () { $("#Button1").click(exportImage); }); function exportImage() { var fileName ="ExportImage"; var type = "Png"; var url = "http://demos.componentone.com/ASPNET/ExportService" + "/exportapi/chart"; $("#<%=C1BarChart1.ClientID%>").c1barchart("exportChart", fileName, type, url); }</script>[/javascript] You can view further samples on how to export Grid and Chart in the following samples: http://demos.componentone.com/ASPNET/controlexplorer/C1GridView/ExportingExcel.aspx and for chart http://demos.componentone.com/ASPNET/controlexplorer/C1BarChart/ExportingImage.aspx.

Thanks for reading.

MESCIUS inc.

comments powered by Disqus