Export to several files

Stimulsoft Reports.JS discussion
Post Reply
jpgb
Posts: 67
Joined: Tue Mar 15, 2016 11:42 am

Export to several files

Post by jpgb »

Is there a way of exporting a report to several files?

For example i have a report with a group by country. Could i have a export wich generated several files, one for each group?

thanks
Andrew
Posts: 4104
Joined: Fri Jun 09, 2006 3:58 am

Re: Export to several files

Post by Andrew »

Hello,

To do this automatically from the preview, sorry, there is no such functionality. But you can export from the code by specially preparing the template and adding some rows of code. If you need a sample, please let us know, we may prepare this.

Thank you.
jpgb
Posts: 67
Joined: Tue Mar 15, 2016 11:42 am

Re: Export to several files

Post by jpgb »

Yes, please. A sample would be great.

It would be insteresting to export a report to several files, assuming the report has one group (for example Client Orders Report - it has a group by Client Code) it generates one file for each different group (Client) with their Orders

Of course the report starts a new page on every new group

Thanks!
JB
Andrew wrote: Mon Aug 16, 2021 8:38 am Hello,

To do this automatically from the preview, sorry, there is no such functionality. But you can export from the code by specially preparing the template and adding some rows of code. If you need a sample, please let us know, we may prepare this.

Thank you.
Lech Kulikowski
Posts: 6197
Joined: Tue Mar 20, 2018 5:34 am

Re: Export to several files

Post by Lech Kulikowski »

Hello,

We need some additional time to prepare a sample for you.

Thank you.
AcidSlide
Posts: 8
Joined: Sat Aug 14, 2021 7:46 pm

Re: Export to several files

Post by AcidSlide »

Hi there,

My question is kinda similar. We want to export directly to different filetypes (ex: PDF, Excel, CSV (data)) without viewing the report and it contains input parameters from the user. We want to display first the input parameters (same in the Viewer/Preview) but instead of doing a render after submitting, directly export it to the different filetypes. Is this possible?

Thanks!
Lech Kulikowski
Posts: 6197
Joined: Tue Mar 20, 2018 5:34 am

Re: Export to several files

Post by Lech Kulikowski »

Hello,

We need some additional time to prepare a sample for you.

Thank you.
AcidSlide
Posts: 8
Joined: Sat Aug 14, 2021 7:46 pm

Re: Export to several files

Post by AcidSlide »

Thank you Lech
Lech Kulikowski wrote: Fri Aug 27, 2021 11:14 am Hello,

We need some additional time to prepare a sample for you.

Thank you.
Lech Kulikowski
Posts: 6197
Joined: Tue Mar 20, 2018 5:34 am

Re: Export to several files

Post by Lech Kulikowski »

Hello,

You can use the following code:

Code: Select all

var report = new Stimulsoft.Report.StiReport();
report.loadFile("Reports/1.mrt");
var exportReport = new Stimulsoft.Report.StiReport();
exportReport.reportUnit = report1.reportUnit;
exportReport.render();
exportReport.renderedPages.clear();

report.renderAsync(function () {
    for (var index = 0; index < report.renderedPages.count; ++index) {
        exportReport.renderedPages.add(report.renderedPages.getByIndex(index));
		exportReport.exportDocument(Stimulsoft.Report.StiExportFormat.Pdf);
		// Export report to PDF format
		
		exportReport.renderedPages.clear();
    }
});
Thank you.
AcidSlide
Posts: 8
Joined: Sat Aug 14, 2021 7:46 pm

Re: Export to several files

Post by AcidSlide »

Lech Kulikowski wrote: Thu Sep 02, 2021 12:55 pm Hello,

You can use the following code:

Code: Select all

var report = new Stimulsoft.Report.StiReport();
report.loadFile("Reports/1.mrt");
var exportReport = new Stimulsoft.Report.StiReport();
exportReport.reportUnit = report1.reportUnit;
exportReport.render();
exportReport.renderedPages.clear();

report.renderAsync(function () {
    for (var index = 0; index < report.renderedPages.count; ++index) {
        exportReport.renderedPages.add(report.renderedPages.getByIndex(index));
		exportReport.exportDocument(Stimulsoft.Report.StiExportFormat.Pdf);
		// Export report to PDF format
		
		exportReport.renderedPages.clear();
    }
});
Thank you.

Thanks Lech! We will try this code snippet. We hope this is what we are looking for.
Lech Kulikowski
Posts: 6197
Joined: Tue Mar 20, 2018 5:34 am

Re: Export to several files

Post by Lech Kulikowski »

Hello,

You are welcome.
Post Reply