Page 1 of 1

NullReferenceException on report.Render()

Posted: Wed Sep 10, 2014 6:33 am
by faddoul.antoine
Hi.

I am trying to use Stimulsoft to export a data grid to excel in a DotNetNuke module.

I am using Stimulsoft 2011(both designer and dlls).

I created a report using the designer, saved it as .dll and included it in the project reference.

In the button click event, i wrote the following code:

Code: Select all

       Report ReportName = new Report();
                // Fill list of business objects here
                StiBusinessObjectData objStiBusinessObjectData = new StiBusinessObjectData("Category", "Name", Value);
                List<StiBusinessObjectData> objCollections = new List<StiBusinessObjectData>();
                objCollections.Add(objStiBusinessObjectData);
                ReportName.RegBusinessObject(objCollections);
                ReportName.Render(false);
                ReportName.ExportDocument(StiExportFormat.Excel2007, strfilename);
When the code was executed, the following exception was thrown:

System.NullReferenceException was caught
HResult=-2147467261
Message=Object reference not set to an instance of an object.
Source=Stimulsoft.Report
StackTrace:
at Stimulsoft.Report.StiReport.GetComponents()
at Stimulsoft.Report.StiReport.RenderReport(StiRenderState renderState)
at Stimulsoft.Report.StiReport.Render(StiRenderState renderState, StiGuiMode guiMode)
at Stimulsoft.Report.StiReport.Render(StiRenderState renderState)
at Stimulsoft.Report.StiReport.Render(Boolean showProgress, Int32 fromPage, Int32 toPage)
at Stimulsoft.Report.StiReport.Render(Boolean showProgress)
at .....ExportGridToExcel1(Object sender, EventArgs e) in
InnerException:

I tried using a blank report and without adding any business objects but the exception would not go away.

Any idea what i am doing wrong?

Thank you

Re: NullReferenceException on report.Render()

Posted: Wed Sep 10, 2014 10:38 am
by Alex K.
Hello,

Can you please send us a sample project which reproduce the issue for analysis.

Thank you.

Re: NullReferenceException on report.Render()

Posted: Thu Sep 11, 2014 6:16 am
by faddoul.antoine
I tried creating a sample project without DotNetNuke but, although the project was identical to the module i created earlier, the exception was not thrown. Could it be related to DotNetNuke? Do i need to add different references for DNN?

Re: NullReferenceException on report.Render()

Posted: Thu Sep 11, 2014 10:55 am
by Alex K.
Hello,

We couldn't reproduce this bug on last version.
Please check the latest build and let us know about the result.

Thank you.

Re: NullReferenceException on report.Render()

Posted: Thu Sep 11, 2014 12:22 pm
by faddoul.antoine
I tried using the latest build and i still got the same problem. Did you try it with DNN? I am using it with DNN 06.02.

Re: NullReferenceException on report.Render()

Posted: Thu Sep 11, 2014 1:11 pm
by Alex K.
Hello,

Can you please send us a simple project which reproduce the issue for analysis.

Thank you.