NullReferenceException on report.Render()
Posted: Wed Sep 10, 2014 6:33 am
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:
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
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);
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