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 exporting to Excel

I have a page with a Grid control to list some data (version 16.3460.0.21).
The grid is working as expected: pagination, sorting, column choose, search (Excel type) but I've found a situation that throws an excepcion and I have no clue of what's happening.
There are about 700 rows in the table and have a pagination of 12 rows per page. Excel and Pdf exporting are working as well... except under a unique situation:
If I put a simple "L" in the Make column search box, the list of searchable items is updated with rows which make contains L:

Curiously, it includes the items with null or whitespace (I don't understand it, but doesn't matter for the moment) and the list is updated with the search parameters:

Ok. Now if I try to export my list to Excel (or Pdf), a NullReferenceException is thrown when calling to the IWorkbook.Export method.
The exception does not bring too much information about what's happening

If I open again the search dropdown and uncheck the whitespace option, the filter succeed again and the export
 works withou exception.
The Make column is nullable but this shouldn't affect to the results.

How can I know what's exactly producing the exception and/or how to fix it??
Thanks in advance

5 Replies

DR Dinesh Rajendiran Syncfusion Team October 29, 2019 03:01 PM UTC

Hi Toni, 
Thanks for contacting syncfusion support. 
The reported exception(i.e. NullReferenceException) is already a known issue in version and it has been fixed in our latest version  
Would you like to upgrade to the latest version or would you need a patch in your version for this issue ? 
Dinesh Rajendiran 

TM Toni Moreno October 29, 2019 03:12 PM UTC

I prefer, at this moment, a patch so a newer version could affect to the rest of the application.
Later I will try a new version and see if everything goes right.

DR Dinesh Rajendiran Syncfusion Team October 31, 2019 12:52 PM UTC

Hi Toni, 

Thanks for contacting syncfusion support. 

We have generated patch for the issue “NullReferenceException while exporting to excel” in version 

Please replace the custom script file “ej.web.all.min.js”  available in the attachment in your application to reflect the changes. 
If you have further queries please get back to us. 
Dinesh Rajendiran 

TO Toni November 6, 2019 12:52 PM UTC

I applied the suggested change to my app but the issue remains the same.

FS Farveen Sulthana Thameeztheen Basha Syncfusion Team November 7, 2019 10:58 AM UTC

Hi Toni, 

Before proceeding this, we need some more additional details to find the cause of the issue. Please share us the following details. 
  1. Complete StackTrace of the issue or Exception.
  2.  Stringified model of the Grid on server side while on Exporting as like below screenshot and copy it into clipboard.
  3. Complete Grid code example(both in client and server side)
  4. Please ensure to clear the browser cache to avoid accidental reference of the old scripts/CSS. There might be chance of referring old scripts.
  5. If possible share us the simple reproducing sample after the patch has been applied.
Farveen sulthana T 

Live Chat Icon For mobile
Up arrow icon