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

NullReferenceException when tryng to save sheet as stream

Hi,
I keep getting this NullReferenceException when trying to save spreadsheet as stream. here is the exception stackTrace:
   à Syncfusion.EJ.Export.SheetExport.InitializeSheet()
   à Syncfusion.EJ.Export.SheetExport.ProcessSheet(WorkbookProperties sheetModel, DataContainer sheetData)
   à Syncfusion.EJ.Export.SheetExport.ExportAsBinary(WorkbookProperties sheetModel, DataContainer sheetData, ExportFormat type, ExcelVersion excelVersion)
   à Syncfusion.EJ.Export.Spreadsheet.Save(String sheetModel, String sheetData, ExportFormat type, ExcelVersion excelVersion)
   à PL_ACALIS.Controllers.ImportExportController.ExportToCsv(String sheetModel, String sheetData) dans c:\...\ImportExportController.cs:ligne 547
   à lambda_method(Closure , ControllerBase , Object[] )
   à System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters)
   à System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
   à System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
   à System.Web.Mvc.Async.AsyncControllerActionInvoker.ActionInvocation.InvokeSynchronousActionMethod()
   à System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState)
   à System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult)
   à System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End()
   à System.Web.Mvc.Async.AsyncResultWrapper.End[TResult](IAsyncResult asyncResult, Object tag)
   à System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult)
   à System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d()
   à System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f()
Note that sheetModel and sheetData are not empty.
any help please.
thanks.


10 Replies

AD aymen drine November 15, 2016 10:25 AM UTC

I have also this js error  occuring when i paste same thing on the spreadsheet:


ej?v=q8HvIdFObD5kdsfbkDamFDDpXFjGoxJyxm9QErt-Lp41:1 Uncaught TypeError: Cannot read property 'indexOf' of undefined(…)getRangeIndices @ ej?v=q8HvIdFObD5kdsfbkDamFDDpXFjGoxJyxm9QErt-Lp41:1_setClipboard @ ej?v=q8HvIdFObD5kdsfbkDamFDDpXFjGoxJyxm9QErt-Lp41:1(anonymous function) @ ej?v=q8HvIdFObD5kdsfbkDamFDDpXFjGoxJyxm9QErt-Lp41:1



SI Silambarasan I Syncfusion Team November 16, 2016 10:42 AM UTC

Hi Aymen, 
 
Thank you for using Syncfusion products. 
 
We have checked the reported issues and we are unable to reproduce it in our end.  We have prepared a sample to demonstrate this and the same can be downloaded from the following sample link.  Also, we would like to know the following details, 
 
1. In which way do you bind the data source into Spreadsheet by either setting JSON data to “rangeSettings” or by importing the excel with import URL property or any other binding? If possible, please share the imported data or excel file that you want to export as stream – CSV type. 
 
2. Could you please let us know if you customize the sheetData and sheetModel values from export action method or from ‘saveAsJSON()’ client-side method? 
 
3. Please share the code snippet if you did any customization after rendered Spreadsheet. 
 
4. Could you please provide us more information about ‘error occurring when paste data in Spreadsheet’ such as data copied within Spreadsheet or from external source, steps to replicate this issue from our side.  
 
 
 
Could you please replicate your issues in the above sample and send back to us with the above information so that we could able to sort out the cause of this issue and provide you a better solution quickly? The information provided would be great help for us to proceed further. 
 
 
Regards, 
Silambarasan I 



AD aymen drine November 16, 2016 12:51 PM UTC

Hi Silambarasan,
Thank you for replaying in such short notice.
  •    First we are using syncfusion dll's version 13.4400.53 (as updated in the sample updated and attached to this post).
  •    My spreadsheet do not contain any data at initialization => the datasource is empty.
  •    I did not customise the values of sheetData or sheetModel.
  •    The only customization i did to the spreadsheet was removing the add_sheet button when the document is ready.
  •    About "paste data in Spreadsheet". The data are copied from external Excel File. Pasting data copied within Spreadsheet work fine.

Thank you for your Help.


Attachment: SpreadsheetSample_updated_6f9978f9.rar


SI Silambarasan I Syncfusion Team November 17, 2016 11:03 AM UTC

Hi Aymen, 
 
Thanks for your update. 
 
Query #1 “NullReferenceException occur when saving the Spreadsheet as Stream”  
 
We have checked the attached sample project and found that the Scripts (ej.web.all.min.js) and CSS (ej.widgets.all.min.css) are referred from v14.3.0.52 which have cross referenced with the v13.4.0.53 assemblies (EJ, EJ.Export, Linq.Base, XlsIO.Base).  This is the cause of the issue “NullReferenceException” while saving the Spreadsheet as Stream. So, we would like to suggest you to refer the Scripts, CSS & assemblies from same product version in your project. Could you please ensure this and get back to us with issue reproducible sample if the issue still persists? 
 
Please refer the below modified sample in v13.4.0.53
 
Note: Script & CSS references version should be same as the assembly version.  
 
Query #2 “js error occuring when i paste same thing on the spreadsheet:” 
 
We have checked the reported issue by copied the data from our sample Excels and paste it in Spreadsheet but we are unable to reproduce it in our end.  Could you please share us your Excel file and provide us more information regarding this issue such as copied range in that Excel file and steps to replicate this issue? So, that we could able to sort out the cause of this issue and provide you a better solution quickly. The information provided would be great help for us to proceed further. 
 
 
 
Regards, 
Silambarasan I 



AD aymen drine November 17, 2016 11:58 AM UTC

Hi Silambarasan,

After updating the js and css files, the problem was solved. Thank you for your halp.

Regards,

Aymen DRINE

Développeur

Tél.:  +216 71 830 444 (LG)

Fax:   +216 71 830 877

Gsm: +216 28 830 445

Skype: fs-aymen

aymen.drine@for-softwares.com

www.for-softwares.com




SI Silambarasan I Syncfusion Team November 18, 2016 05:57 AM UTC

Hi Aymen, 
 
Thanks for your update.  We are happy to hear that your issue has been resolved. 
Kindly get back to us if you need any further assistance. 
 
Regards, 
Silambarasan I 



AD aymen drine November 24, 2016 10:41 AM UTC

Hi Silambarasan,

I would like to ask you about ExportToExcel Url. Can i add some parameters to the URL, checkbox for example? and how to do so?

Thank you.


SI Silambarasan I Syncfusion Team November 25, 2016 09:17 AM UTC

Hi Aymen, 
 
Thanks for your update. 
 
We have checked your requirement “To add additional parameters on ExcelExport” and we would like to let you know that, currently we don’t have event for adding parameters on exporting.  However, we considered this as an improvement and this will be available in our Essential Studio 2016 Volume 4 Service Pack 1 release.  
 
 
Regards, 
Silambarasan I 



AD aymen drine November 25, 2016 10:04 AM UTC

Silambarasan I,

Thank you for your help.

Regards.


SI Silambarasan I Syncfusion Team November 28, 2016 04:50 AM UTC

Hi Aymen, 
 
Thanks for the update. 
Please let us know if you need any further assistance on this. We will be happy to help you. 
 
Regards, 
Silambarasan I 


Loader.
Live Chat Icon For mobile
Up arrow icon