Excel Exporting not Working VB

Hi, can you help me, i was reading this thread https://www.syncfusion.com/forums/129935/grid-excel-export-not-working-in-server but can't make the export option works, let me share my code and my error.

CODE BEHIND:
    Protected Sub grid_RepCumplimiento_ServerExcelExporting(sender As Object, e As Syncfusion.JavaScript.Web.GridEventArgs) Handles grid_RepCumplimiento.ServerExcelExporting
        Dim exp As ExcelExport = New ExcelExport()
        exp.Export(grid_RepCumplimiento.Model, CType(grid_RepCumplimiento.DataSource, IEnumerable), "Export.xlsx", ExcelVersion.Excel2010, True, True, "default-theme")
    End Sub

ERROR:
An exception of type 'System.NullReferenceException' occurred in Syncfusion.EJ.Export.dll but was not handled in user code

Can you help me to see where is the error/ my failure?

Thanks in advance.


Edit: I have all dependencies, based on this: https://help.syncfusion.com/js/dependencies
And the anotations i've read on https://www.syncfusion.com/forums/129935/grid-excel-export-not-working-in-server

11 Replies

AV Alejandro Villagomez May 30, 2018 07:19 PM UTC

ASPX:
        <ej:Grid ID="grid_RepCumplimiento" runat="server" AllowGrouping="true" AllowSorting="true" AllowPaging="false"
            OnServerExcelExporting="grid_RepCumplimiento_ServerExcelExporting1"
            OnServerPdfExporting="grid_RepCumplimiento_ServerPdfExporting" OnServerWordExporting="grid_RepCumplimiento_ServerWordExporting">
            <ToolbarSettings ShowToolbar="true" ToolbarItems="excelExport,wordExport,pdfExport"></ToolbarSettings>
            <GroupSettings  GroupedColumns="Region,Sucursal"></GroupSettings>
            <TextWrapSettings WrapMode="Both" />
            <SummaryRows>
                <ej:SummaryRow Title="Totales">
                    <SummaryColumn>
                       <ej:SummaryColumn SummaryType="Sum" DisplayColumn="Encuestas" DataMember="Encuestas" />
                    </SummaryColumn>
                    <SummaryColumn>
                       <ej:SummaryColumn SummaryType="Sum" DisplayColumn="BajasNoTransfer" DataMember="BajasNoTransfer" />
                    </SummaryColumn>
                    <SummaryColumn>
                       <ej:SummaryColumn SummaryType="Sum" DisplayColumn="BajasSinEncuesta" DataMember="BajasSinEncuesta" />
                    </SummaryColumn>
                </ej:SummaryRow>
            </SummaryRows>
            <Columns>
                <ej:Column Field="Cliente" HeaderText="CLIENTE" />
                <ej:Column Field="Sucursal" HeaderText="SUCURSAL" />
                <ej:Column Field="Region" HeaderText="REGION" />
                <ej:Column Field="Encuestas" HeaderText="ENCUESTAS APLICADAS" />
                <ej:Column Field="BajasNoTransfer" HeaderText="BAJAS TOTALES(NO TRANSFERS)" />
                <ej:Column Field="BajasSinEncuesta" HeaderText="BAJAS SIN ENCUESTA" />
                <ej:Column Field="PorcentajeAplicadas" HeaderText="% ENCUESTAS APLICADAS" Format="{0:p}" />
            </Columns> 
        </ej:Grid>


KM Kuralarasan Muthusamy Syncfusion Team May 31, 2018 12:38 PM UTC

Hi Alejandro, 

Thanks for contacting Syncfusion support. 

We have analyzed your issue and we found that you have used format in your Grid column. We suspect that this format is causing the problem. If you could confirm the following details, we can provide you details and solution to overcome the problem.  

  1. Stack trace of the issue
  2. Essential Studio version

Regards, 
Kuralarasan M. 



AV Alejandro Villagomez May 31, 2018 10:14 PM UTC

Well, the Call Stack window doesn't show anything useful, but i think it's because the Datasource seems to have nothing when trying to Export. I've uploaded some images, and the version of the Syncfusion is 15.4.0.20.

I've tried removing the format for the column, but, same error.



Attachment: CallStack_579a5389.zip


KM Kuralarasan Muthusamy Syncfusion Team June 1, 2018 01:21 PM UTC

Hi Alejandro, 
 
From your screenshot, we could see that dataSource is nothing while Excel Exporting. While Grid export, the dataSource passed to the exporting method is compared with the Grid dataSource. Thus, when a column is not defined in the Grid dataSource, it is obtained as null value and hence throws a null exception. So please ensure this cause in your project. 
 
We have already discussed about this topic in our following kb documentation: 
 
 
Also we have prepared the sample with your requirement in VB. Please refer the following link to sample, 
 
 
We have used your Essential Studio version (15.4.0.20) in this sample.  
 
Still if you face this issue, please share the following details for further assistance, 
  1. If possible, Reproduce the issue in the attached sample and send back to us.
Regards, 
Kuralarasan M. 



AV Alejandro Villagomez June 1, 2018 05:53 PM UTC

I'll try to reproduce the issue, but, can't make it work, if i try to run it it gives me the following error:

All columns exists, i'll attach the ASP and VB file in the next reply.

Parser Error Message: The base class includes the field 'Grid1', but its type (Syncfusion.JavaScript.Web.Grid) is not compatible with the type of control (Syncfusion.JavaScript.Web.Grid).


AV Alejandro Villagomez June 1, 2018 07:11 PM UTC

Here are my elements on a ZIP File

This includes:
-ASPX File
-Designer VB File
-VB File
-A Text file with the data loaded on the Grid
-A screenshot of the error

Can´t reproduce the issue on your solution, i've never make it run.

Hope to find the solution to this one. Thanks in Advance!!!

Attachment: GridElements_f0f72968.zip


KM Kuralarasan Muthusamy Syncfusion Team June 4, 2018 12:33 PM UTC

Hi Alejandro, 

We have used “15.4450.0.20” this DLL version in our sample. We suspect that this version DLL’s are not present in your machine. So now we have prepared the sample with our DLL’s, this DLL’s are referred from the project bin folder. So please do not clean this project before run. 
Please check with this sample, 


Please reproduce your issue in this sample and send that sample to us. 

Regards, 
Kuralarasan M. 



AV Alejandro Villagomez June 4, 2018 04:47 PM UTC

Ok, seems assemblies are OK, let me reinstall them, and try it, because your example runs fine, i'll attach some screenshots of my references once it's done.

I have the AjaxcontrolToolkit, that could make the error? I'll try it too, give some time and i'll send my comments after the reinstalling.

Thanks In advance!


AV Alejandro Villagomez June 4, 2018 06:43 PM UTC

Well tried all, but still getting the issue, i've attached all my references, if you need it, i can send all project.
I'll try it with a new project too, but i think maybe it's some reference or JS file.

Or a TeamViewer connection?

Thanks for all the support!

Attachment: References_af3816aa.zip


AV Alejandro Villagomez June 5, 2018 07:25 PM UTC

Well, i've tried on a new project and everything is working fine... So, i don't really get it why on that project is not working!

Some help here please.

UPDATE: If i add a new webform and only add your code example, everything it's fine; but, when i add my code is when something happen and doesn't work the EXPORT, any ideas what to see on the configuration or did i miss something or maybe some references are causing this kind of effect?

When i add this line Protected _db As New OH_EncuestaSalida.OH_EncuestaSalida_Entities() the Syncfusion.Linq reference just change from not necessary to necessary, maybe the System.Linq and Syncfusion.Linq are causing the issue. It's the only thing i can see that changes.


KM Kuralarasan Muthusamy Syncfusion Team June 6, 2018 12:36 PM UTC

Hi Alejandro, 

We have analyzed your query and we have created a support incident for your further assistance. Please log on to our support website to check for further updates.

https://www.syncfusion.com/support/directtrac/incidents
 
 
Regards, 
Kuralarasan M. 


Loader.
Up arrow icon