Saving report by pages into hard drive

Stimulsoft Reports.NET discussion
Post Reply
ba.berezin
Posts: 2
Joined: Mon Jun 10, 2024 11:32 am

Saving report by pages into hard drive

Post 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?
Lech Kulikowski
Posts: 7333
Joined: Tue Mar 20, 2018 5:34 am

Re: Saving report by pages into hard drive

Post by Lech Kulikowski »

Hello,

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

Thank you.
ba.berezin
Posts: 2
Joined: Mon Jun 10, 2024 11:32 am

Re: Saving report by pages into hard drive

Post 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.
Lech Kulikowski
Posts: 7333
Joined: Tue Mar 20, 2018 5:34 am

Re: Saving report by pages into hard drive

Post 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.
Post Reply