I'm currently developping an application with lot's of reports. The end user can design reports as needed and the templates are stored in a database.
Code: Select all
void StiDesigner_SavingReport(object sender, StiSavingObjectEventArgs e)
{
StiDesignerControl designerControl = sender as StiDesignerControl;
StiReport report = designerControl.Report;
//Save to database
if (currentReportTemplate != null)
{
if (currentReportTemplate.Key == -1)
{
//A new one - get description
String description = HelperForms.XtraInputBox.Show("Bitte geben Sie eine Bezeichnung für den neuen Report ein.", "Neuer Report", "Neuer Report");
currentReportTemplate.Description = description;
}
if (!String.IsNullOrEmpty(currentReportTemplate.Description))
{
currentReportTemplate.ReportLayout = report.SaveToString();
Repository.ReportTemplate.ReportTemplateRepository.Instance.SaveTemplate(currentReportTemplate);
}
}
else if (currentEsrJournalTemplate != null)
{
currentEsrJournalTemplate.ReportLayout = report.SaveToString();
Repository.ReportTemplate.ReportTemplateRepository.Instance.SaveTemplate(currentEsrJournalTemplate);
}
report.IsModified = false;
e.Processed = true;
}
Code: Select all
public void ShowReportDesigner(Boolean loadLayout)
{
StiReport report = new StiReport();
StiMainMenuService mainMenu = StiConfig.Services.GetService(typeof(StiMainMenuService)) as StiMainMenuService;
if (mainMenu != null)
{
mainMenu.ShowFileReportNew = false;
mainMenu.ShowFileReportOpen = false;
mainMenu.ShowFileReportSaveAs = false;
}
StiStandardToolbarService standardToolbar = StiStandardToolbarService.GetService();
if (standardToolbar != null)
{
standardToolbar.ShowReportNew = false;
standardToolbar.ShowReportOpen = false;
}
report.ScriptLanguage = StiReportLanguageType.CSharp;
report.IsModified = false;
//subscripte to save event
Stimulsoft.Report.Design.StiDesigner.SavingReport += StiDesigner_SavingReport;
//load report layout
if (loadLayout)
{
if (currentReportTemplate != null)
{
if (!String.IsNullOrEmpty(currentReportTemplate.ReportLayout))
report.LoadFromString(currentReportTemplate.ReportLayout);
}
else if (currentEsrJournalTemplate != null)
{
if (!String.IsNullOrEmpty(currentEsrJournalTemplate.ReportLayout))
report.LoadFromString(currentEsrJournalTemplate.ReportLayout);
}
}
if (currentReportTemplate != null)
{
Rds.Campaign campaigns = new Rds.Campaign();
report.RegBusinessObject("Campaigns", campaigns);
report.Dictionary.SynchronizeBusinessObjects(5);
}
else if (currentEsrJournalTemplate != null)
{
Rds.EsrFile file = new Rds.EsrFile();
report.RegBusinessObject("ESR-Journal", file);
report.Dictionary.SynchronizeBusinessObjects(5);
}
report.Design(true);
//unsubscripe from event
Stimulsoft.Report.Design.StiDesigner.SavingReport -= StiDesigner_SavingReport;
}
Code: Select all
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an object.
at Stimulsoft.Report.Components.StiPage.get_GridSize()
at Stimulsoft.Report.Design.Tools.StiSelectToolService.ConvertRectangle(RectangleD rect)
at Stimulsoft.Report.Design.Tools.StiSelectToolService.OnMouseDown(Object sender, MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseDown(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.34014 built by: FX45W81RTMGDR
CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll
----------------------------------------
Designer
Assembly Version: 2014.1.1900.0
Win32 Version: 2014.1.1900.0
CodeBase: file:///C:/Program%20Files%20(x86)/Stimulsoft%20Reports.Ultimate%202014.1/Bin/Designer.exe
----------------------------------------
Stimulsoft.Report
Assembly Version: 2014.1.1900.0
Win32 Version: 2014.1.1900.0
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Stimulsoft.Report/2014.1.1900.0__ebe6666cba19647a/Stimulsoft.Report.dll
----------------------------------------
System
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.34003 built by: FX45W81RTMGDR
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
Stimulsoft.Base
Assembly Version: 2014.1.1900.0
Win32 Version: 2014.1.1900.0
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Stimulsoft.Base/2014.1.1900.0__ebe6666cba19647a/Stimulsoft.Base.dll
----------------------------------------
System.Windows.Forms
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.33440 built by: FX45W81RTMREL
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.33440 built by: FX45W81RTMREL
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
Stimulsoft.Report.Design
Assembly Version: 2014.1.1900.0
Win32 Version: 2014.1.1900.0
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Stimulsoft.Report.Design/2014.1.1900.0__ebe6666cba19647a/Stimulsoft.Report.Design.dll
----------------------------------------
Stimulsoft.Controls.Win
Assembly Version: 2014.1.1900.0
Win32 Version: 2014.1.1900.0
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Stimulsoft.Controls.Win/2014.1.1900.0__ebe6666cba19647a/Stimulsoft.Controls.Win.dll
----------------------------------------
System.Xml
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.33440 built by: FX45W81RTMREL
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Data
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.33440 built by: FX45W81RTMREL
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_64/System.Data/v4.0_4.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------
System.Core
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.33440 built by: FX45W81RTMREL
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
Stimulsoft.Controls
Assembly Version: 2014.1.1900.0
Win32 Version: 2014.1.1900.0
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Stimulsoft.Controls/2014.1.1900.0__ebe6666cba19647a/Stimulsoft.Controls.dll
----------------------------------------
Stimulsoft.Editor
Assembly Version: 2014.1.1900.0
Win32 Version: 2014.1.1900.0
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Stimulsoft.Editor/2014.1.1900.0__ebe6666cba19647a/Stimulsoft.Editor.dll
----------------------------------------
Accessibility
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.33440 built by: FX45W81RTMREL
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/Accessibility/v4.0_4.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
----------------------------------------
Stimulsoft.Report.Check
Assembly Version: 2014.1.1900.0
Win32 Version: 2014.1.1900.0
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Stimulsoft.Report.Check/2014.1.1900.0__ebe6666cba19647a/Stimulsoft.Report.Check.dll
----------------------------------------
Stimulsoft.Report.Helper
Assembly Version: 2014.1.1900.0
Win32 Version: 2014.1.1900.0
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Stimulsoft.Report.Helper/2014.1.1900.0__ebe6666cba19647a/Stimulsoft.Report.Helper.dll
----------------------------------------
Stimulsoft.Report.Win
Assembly Version: 2014.1.1900.0
Win32 Version: 2014.1.1900.0
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Stimulsoft.Report.Win/2014.1.1900.0__ebe6666cba19647a/Stimulsoft.Report.Win.dll
----------------------------------------
Stimulsoft.Report.Design.WebViewer
Assembly Version: 2014.1.1900.0
Win32 Version: 2014.1.1900.0
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Stimulsoft.Report.Design.WebViewer/2014.1.1900.0__ebe6666cba19647a/Stimulsoft.Report.Design.WebViewer.dll
----------------------------------------
Stimulsoft.Report.Design.SLViewer
Assembly Version: 2014.1.1900.0
Win32 Version: 2014.1.1900.0
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Stimulsoft.Report.Design.SLViewer/2014.1.1900.0__ebe6666cba19647a/Stimulsoft.Report.Design.SLViewer.dll
----------------------------------------
Stimulsoft.Report.Design.RTViewer
Assembly Version: 2014.1.1900.0
Win32 Version: 2014.1.1900.0
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Stimulsoft.Report.Design.RTViewer/2014.1.1900.0__ebe6666cba19647a/Stimulsoft.Report.Design.RTViewer.dll
----------------------------------------
System.Configuration
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.33440 built by: FX45W81RTMREL
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.
For example:
<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>
When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
Thank you for your help!