We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Updated Mapper WebAPI controller sample

Hi there,
I'm trying to build import and export using my WebAPI controller.
I'm using sample from http://help.syncfusion.com/js/spreadsheet/server-configuration.

As Spreadsheet.Save is static I've changed code to:

public void ExportToExcel()

{

string sheetModel = HttpContext.Current.Request.Params["sheetModel"], sheetData = HttpContext.Current.Request.Params["sheetData"];

Spreadsheet.Save(sheetModel, sheetData, "sample", ExportFormat.XLSX, ExcelVersion.Excel2013);

}

,but I'm getting exception on this method.
Also import process, but after that when I'm trying to export I receive JavaScript error.

When I use http://js.syncfusion.com/ExportingServices/api/JSXLExport all runs without any error.

Could you provide please updated Mapper WebAPI controller sample ?


Also when I'm running sample from https://www.syncfusion.com/forums/121883/import-export-to-function-json-instead-of-excelurl with ej.web.all.min.js 14.1.0.41 or 14.1.0.46 it returns exception (Unable to get property 'text' of undefined or null reference - ej.web.all.min.js (10,4050813)

Kind regards,
Alex















7 Replies

SI Silambarasan I Syncfusion Team May 16, 2016 11:32 AM UTC

Hi Alex, 
 
Thank you for your interest in Syncfusion products. 
 
Query #1 “Im trying to build import and export using my webapi controller….but I’m getting exception in this method. Also import process….export I receive javascript error. Could you provide please updated Mapper WebApi controller sample?” 
 
We have analyzed your reported issue and we are unable to reproduce it in our end.  We have prepared a sample to demonstrate the “Spreadsheet Import and export using WebApi Controller” and the same can be downloaded from the following link. 
 
 
Could you please replicate your issues (Getting exception on ExportToExcel() method and JavaScript error on exporting) in the above sample and get back to us with more information to reproduce it so that we can analyze based on that and provide you better solution? The information provided would be a great help for us to resolve this issue. 
 
Query #2 “When I’m running sample from forum 121883 with ej.web.all.min 14.1.0.41 and 14.1.0.46 it returns exception (unable to get property text of undefined or null reference)” 
 
In that forum 121883, we have provided the solution by using the extended ejSpreadsheet script and also have logged the improvement task for the requirement “Spreadsheet export in JSON format” and completed it.  On from the Essential studio 2015 Volume 4 Service pack 1 release, we have included the “saveAsJSON()” method to get the Spreadsheet in JSON format and also we have made some improvements in import and export functionalities.  So that saveAsJSON string returned from the extended script is not compatible with latest source.  
 
However, we have modified the provided sample in the forum 121883 and the same can be downloaded from the following link. 
 
 
 
Regards, 
Silambarasan I 



AB Alexander Borisov May 16, 2016 02:36 PM UTC

Thank you Silambarasan I ,
I've resolved all my issues using provided code.
Unfortunately I can't reproduce all errors. I've managed to reproduce only one.
If I add loadComplete function with currency type I've got an exception in Export Controller ( this is not important for me )

function loadComplete(args) {

var xlObj = $("#Spreadsheet").data("ejSpreadsheet"), xlFormat = xlObj.XLFormat;

if (!xlObj.isImport) {

xlFormat.format({ "type": "currency" }, "A1:A1");

}

}





SI Silambarasan I Syncfusion Team May 17, 2016 12:49 PM UTC

Hi Alex, 
 
Thanks for your update. 
 
We have analyzed the reported issue “If I add loadComplete function with currency type I have got an exception in Export controller” and we are unable to reproduce it in our end.  And, we would like to know the following information: 
 
1. Stack trace details (exception details). 
2. Data binded to Spreadsheet. 
 
Could you please share the above details and so that we can analyze based on that and provide you better solution. The information provided would be great help for us to resolve your issue. 
 
Regards, 
Silambarasan I 



AB Alexander Borisov May 17, 2016 01:06 PM UTC

Hi Silambarasan I,
project is attached.
After running project try to  export to Excel empty sheet.

Kind regards,
Alex

Attachment: SpreadsheetWebserviceSample_8bc4ece8.zip


SI Silambarasan I Syncfusion Team May 18, 2016 11:37 AM UTC

Hi Alex, 
 
Sorry for the inconvenience caused.  
 
We have checked the reported issue in the attached sample project and we are unable to reproduce it.  So, we have prepared a simple video demonstration of the given sample and the same can be downloaded from the below link. 
 
 
And, we would like to know the following details, 
 
1. Exception error details. 
2. Screenshot of returned response from the export (post) action. 
 
Could you please share the above information and so that we can analyze based on that and provide you better solution. The information provided would be great help for us to resolve your issue. 
 
Regards, 
Silambarasan I 



AB Alexander Borisov May 18, 2016 12:39 PM UTC

Hi
I think the issue occur only  when server globalization is different than en-US.
When I add in web.config :
<globalization fileEncoding="utf-8" requestEncoding="utf-8" responseEncoding="utf-8" culture="en-US" uiCulture="en-US" />
 the all runs smoothly, but if I set it in different culture, for example:

<globalization fileEncoding="utf-8" requestEncoding="utf-8" responseEncoding="utf-8" culture="de-DE" uiCulture="de-DE" />
I've get an error

Regards,
Alex



MK Mohan Kumar Ramasamy Syncfusion Team May 19, 2016 12:00 PM UTC

Hi Alex, 
 
Thanks for your update. 
 
We considered this “Spreadsheet Excel Export with globalization” as an improvement task and a support incident has been created under your account to track the status of this requirement. Please log on to our support website to check for further updates. 

Regards, 
Mohankumar R. 


Loader.
Live Chat Icon For mobile
Up arrow icon