Export to Excel

Posted by: mailtosrik on 8 September 2017, 11:31 pm EST

  • Posted 8 September 2017, 11:31 pm EST


    Any options available to export excel in LS html client in VS 2013. I am struggling here. please help me out. I don't have flexi grid in HTML client too. What shall i need to do
  • Replied 8 September 2017, 11:31 pm EST


    We are working on creating a sample application to fulfill your requirement. We will soon share our observations on the same.

    Manpreet Kaur
  • Replied 8 September 2017, 11:31 pm EST

    Thanks a lot Manpreet Kaur ! i am waiting for your sample..
  • Replied 8 September 2017, 11:31 pm EST


    You would need to install the Wijmo Export Service so as to export the data from WijGrid to Excel. You can download the export service from the following link: http://prerelease.componentone.com/dotnet30/C1WebWijmo.Webforms/2015-T1/. Here is the link: http://wijmo.com/docs/wijmo/ExportServiceSetup.html, which points to the install instructions.

    Once you have downloaded and installed the export service, you can call the "exportGrid" method of WijGrid to export the data to excel. Here is the sample code, that can be put in the button execute snippet:

    $("#demo").wijgrid("exportGrid", "grid","xls");

    You can refer to the following link: http://wijmo.com/docs/wijmo/#Wijmo~wijmo.grid.wijgrid~exportGrid.html, which describes the exportGrid method in detail. In the above code you could observe that I have not passed the export service url, because by default, the serviceUrl parameters of the exportChart and exportGrid methods are set to use ComponentOne's demo ExportService. You may pass the url of the service which you have installed locally on your machine.

    Note: You need to set the id of the div element like this:

    var table = $("<table id='demo'/>");

    Hope it helps.

    Manpreet Kaur
  • Replied 8 September 2017, 11:31 pm EST

    Thanks for the info Manpreet,
    In the given link http://prerelease.componentone.com/dotnet30/C1WebWijmo.Webforms/2015-T1/ files are there but no executable files to install (Enclosed the screenshot for the reference)
  • Replied 8 September 2017, 11:31 pm EST


    You can find the setup of ExportService at the following link:
    C:\Program Files (x86)\ComponentOne\Studio for ASP.NET WebForms

    Else, you can deploy the sample available at the link given provided by Manpreet on IIS and use it as url.

  • Replied 8 September 2017, 11:31 pm EST

    Hi all,

    I used the demo export service mentioned in one of the articles and my code is tied to an export button as seen below:

    myapp.CustomerPrefAggGrids.mServiceExport_execute = function (screen) {

    serviceUrl: "http://demos.componentone.com/ASPNET/ExportService/exportapi/grid",
    grid: $("table").data("wijmo-wijgrid"),
    fileName: "MyGridExport",
    exportFileType: wijmo.exporter.ExportFileType["Xlsx"],
    excel: {
    author: "Ninja Code Monkey",
    autoRowHeight: true

    //only exporting initial data set, not exporting data set post filters

    The export works fine on the initial data set populated in the grid. I have another button that reloads the page with user specified filter parameters. The screen reloads fine and the data set in the grid is updated as per the parameters the user selected. However, when I execute the export, the original data set is exported to Excel and not the data set with the filters applied.

    Filter method is below:

    myapp.CustomerPrefAggGrids.mFilter_execute = function (screen) {

    myapp.showScreen("CustomerPrefAggGrids", null, {
    beforeShown: function (browseScreen) {

    var jvJBASuppliernum = screen.spJbasuppliernumFilterLocal;
    var jvControllercode = screen.spControllercodeFilterLocal;
    var jvPrefStatusFilter = screen.spPrefstatusFilterLocal;
    var jvDepotnum = screen.spDepotnumFilterLocal;
    var jvPrefrank = screen.spPrefrankFilterLocal;
    var jvStockStatus = screen.spStockstatusFilterLocal;
    var jvLoaddtStart = screen.spLoaddtStartFilterLocal;
    var jvLoaddtEnd = screen.spLoaddtEndFilterLocal;

    browseScreen.spJbasuppliernumFilter = jvJBASuppliernum;
    browseScreen.spControllercodeFilter = jvControllercode;
    browseScreen.spPrefstatusFilter = jvPrefStatusFilter;
    browseScreen.spDepotnumFilter = jvDepotnum;
    browseScreen.spPrefrankFilter = jvPrefrank;
    browseScreen.spStockstatusFilter = jvStockStatus;
    browseScreen.spLoaddtStartFilter = jvLoaddtStart;
    browseScreen.spLoaddtEndFilter = jvLoaddtEnd;

    browseScreen.spJbasuppliernumFilterLocal = jvJBASuppliernum;
    browseScreen.spControllercodeFilterLocal = jvControllercode;
    browseScreen.spPrefstatusFilterLocal = jvPrefStatusFilter;
    browseScreen.spDepotnumFilterLocal = jvDepotnum;
    browseScreen.spPrefrankFilterLocal = jvPrefrank;
    browseScreen.spStockstatusFilterLocal = jvStockStatus;
    browseScreen.spLoaddtStartFilterLocal = jvLoaddtStart;
    browseScreen.spLoaddtEndFilterLocal = jvLoaddtEnd;



    I find it weird that LS retains the original data in the wijgrid even though I reloaded the page with a new set of parameters...
  • Replied 8 September 2017, 11:31 pm EST


    We apologize for the delayed response. We are investigating the issue further at our end. We will soon share our observations on the same.

    Manpreet Kaur
  • Marked as Answer

    Replied 8 September 2017, 11:31 pm EST


    I was not able to replicate the issue at my end with the latest version of Studio for LightSwitch HTML i.e. 2015v1.48. You may refer to the attached video which depicts the steps followed at my end to reproduce the issue and the output observed. We could observe that it correctly exports the filtered data to Excel. I have uploaded the sample used for testing at the following link:http://supportftp.componentone.com/Export_FilteredData.zip. You may refer to the same.

    I would suggest you to test the issue with the latest version, which you can download from the following link: https://www.componentone.com/Download/

    Hope it helps. In case the issue still persists, I would request you to modify the attached sample application to depict your issue, so that I can replicate the issue at my end and debug it further.

    Manpreet Kaur
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels