For faster reports

Stimulsoft Reports.NET discussion
Post Reply
Sacha
Posts: 19
Joined: Tue Mar 27, 2007 11:21 am
Location: Montréal

For faster reports

Post by Sacha »

Hi !

We are trying to speed up our reporting engine and I would like to see what can be done to speed things up on the report side. For now, we are using the following code :

StiReport stiReport = new StiReport();
xmlData.Position = 0;
DataSet dataset = new DataSet();
dataset.ReadXml(xmlData);
stiReport.Load(sessionInfo.SummaryReportPath);
stiReport.Dictionary.DataStore.Clear();
stiReport.Dictionary.Databases.Clear();
stiReport.RegData("Visit", dataset);
stiReport.Dictionary.Synchronize();
stiReport.PrinterSettings.ShowDialog = false;
stiReport.Compile();
stiReport.CompiledReport.Rendering += new EventHandler(OnRendering);
stiReport.Render(false);
stiReport.Print(GetPrinterSettings(sessionInfo));
xmlData.Close();
stiReport.Dispose();

I think there's an optimization possible if I use compiled reports, but I'm not sure what are the implications of using them, is there any other thing we can do to speed things up with this ?

Thanks

Sacha
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

For faster reports

Post by Edward »

Please modify your code in following way:

Code: Select all

StiReport stiReport = null;
xmlData.Position = 0;
DataSet dataset = new DataSet();
dataset.ReadXml(xmlData);

string compiledReportFile = "report.dll";
if (!File.Exists(compiledReportFile))
{
  stiReport = new StiReport();
  stiReport.Load(sessionInfo.SummaryReportPath);
  stiReport.Dictionary.DataStore.Clear();
  stiReport.Dictionary.Databases.Clear();
  stiReport.RegData("Visit", dataset);
  stiReport.Dictionary.Synchronize();
  stiReport.Compile(compiledReportFile);
  stiReport.CompiledReport.Rendering += new EventHandler(OnRendering);
}
else
{
    stiReport = StiReport.GetReportFromAssembly(compiledReportFile, true);
    stiReport.RegData("Visit", dataset);
    stiReport.Rendering += new EventHandler(OnRendering);
}
  stiReport.PrinterSettings.ShowDialog = false;
  stiReport.Render(false);
  stiReport.Print(GetPrinterSettings(sessionInfo));
  xmlData.Close();
  stiReport.Dispose();
Thank you.
Sacha
Posts: 19
Joined: Tue Mar 27, 2007 11:21 am
Location: Montréal

For faster reports

Post by Sacha »

Wow ! Huge improvement !!!

Thanks a lot ! :)

Sacha
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

For faster reports

Post by Edward »

Let us know, if you need any help.

Thank you.
Post Reply