Report duplication doesn't duplicate images

Stimulsoft Reports.NET discussion
Post Reply
User avatar
Fabio Pagano
Posts: 355
Joined: Mon Apr 16, 2007 12:38 pm
Location: Bari (Italy)

Report duplication doesn't duplicate images

Post by Fabio Pagano »

Good evening.

In our software we have a routine of report duplication.

In version 2013.2.1700.0 it worked fine, then we have passed to version 2015.2.0.0 and the images weren't copied anymore in the new duplicated report.

Here is the sample code (at the third line change the .mdz path to load):

Code: Select all

        Dim OriginalReport As New Stimulsoft.Report.StiReport
        OriginalReport.LoadDocument("C:\S000000001.mdz")
        Dim DuplicatedReport As New Stimulsoft.Report.StiReport
        DuplicatedReport.RenderedPages.Clear()
        OriginalReport.ReportUnit = DuplicatedReport.ReportUnit
        Dim MyPage As Integer
        MyPage = 0
        For Each page As Stimulsoft.Report.Components.StiPage In OriginalReport.RenderedPages
            MyPage += 1
            page.Report = DuplicatedReport
            page.Guid = System.Guid.NewGuid().ToString().Replace("-", "")
            DuplicatedReport.RenderedPages.Add(page)
        Next
        OriginalReport.Dispose()
        OriginalReport = Nothing
        DuplicatedReport.ReportAlias = ""
        DuplicatedReport.ReportDescription = ""
        Dim report As Stimulsoft.Report.StiReport
        report = DuplicatedReport
        'Show the report
        report.NeedsCompiling = False
        report.IsRendered = True
        report.Show(True)
Attached is the zipped original .mdz file you can use for duplication.

Thank you.
Attachments
S000000001.zip
Test report (with image in the upper left) to duplicate.
(18.85 KiB) Downloaded 143 times
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Report duplication doesn't duplicate images

Post by Alex K. »

Hello,

Please try to add the Clear() method for the rendered pages in the original report:

Code: Select all

...
}
OriginalReport.RenderedPages.Clear();
OriginalReport.Dispose();
OriginalReport = null;
...
Thank you.
User avatar
Fabio Pagano
Posts: 355
Joined: Mon Apr 16, 2007 12:38 pm
Location: Bari (Italy)

Re: Report duplication doesn't duplicate images

Post by Fabio Pagano »

Worked.

Thank you.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Report duplication doesn't duplicate images

Post by Alex K. »

Hello,

We are always glad to help you!
Let us know if you need any additional help.

Thank you.
Post Reply