Page 1 of 1

Saving report by pages into hard drive

Posted: Mon Jun 10, 2024 12:01 pm
by ba.berezin
Hello every one.
I have the problem with using a lot of memory for creating StiReport. My app creates a report by pages, and saves the main report into hard drive in the end. The main report becomes large in the process.

Step 1: I'm creating a main report:

Code: Select all

 var mainReport = new StiReport()
 {
     IsRendered = true,
     NeedsCompiling = false,
     ReportName = "Some name"
 };
Step 2: Then I'm rendering another report, and adding pages into the main report:

Code: Select all

var report = new StiReport();
// this some code
await report.RenderAsync();
foreach (StiPage page in report.RenderedPages)
{
     page.Report = mainReport;
     page.Guid = Guid.NewGuid().ToString("N");
     mainReport.RenderedPages.Add(page);
}
// here the main report becomes large
Step 3: Then I'm saving the main report into hard drive:

Code: Select all

var data = mainReport.SavePackedDocumentToByteArray();
// this saving into hard drive by stream
How to save report pages into hard drive after adding pages into "RenderedPages" pages? maybe i have mistake and must use another solution?

Re: Saving report by pages into hard drive

Posted: Wed Jun 12, 2024 9:42 am
by Lech Kulikowski
Hello,

Sorry, we did not exactly understand your question. Could you explain your issue in more detail?

Thank you.

Re: Saving report by pages into hard drive

Posted: Thu Jun 13, 2024 5:21 am
by ba.berezin
I want to save my report into hard drive as pages are added to the report (one by one, the file in hard drive should to update). Now I store all pages in memory and I save them into hard drive in the end.

Re: Saving report by pages into hard drive

Posted: Thu Jun 13, 2024 6:59 am
by Lech Kulikowski
Hello,

You can add the Save method for the page:
page.Report = mainReport;
page.Guid = Guid.NewGuid().ToString("N");
page.Save("path");
mainReport.RenderedPages.Add(page);

Thank you.