cancel
Showing results for 
Search instead for 
Did you mean: 

ReportDocument to load from a Memory Stream

Former Member

Hi,

It would be very efficient if u can implement an overload to ReportDocument.load() function to accept a memory stream, for templates that we are using too much, we can load them once so lessening the IO, and use them a lot.

Regards.

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hello,

You can actually, just be very careful about managing the objects and you MUST close and dispose of each report once completed.

public class frmMain : System.Windows.Forms.Form

{

CrystalDecisions.CrystalReports.Engine.ReportDocument rpt = new CrystalDecisions.CrystalReports.Engine.ReportDocument();

CrystalDecisions.CrystalReports.Engine.ReportDocument rpt1 = new CrystalDecisions.CrystalReports.Engine.ReportDocument();

CrystalDecisions.ReportAppServer.ClientDoc.ISCDReportClientDocument rptClientDoc;

CrystalDecisions.ReportAppServer.ClientDoc.ISCDReportClientDocument rptClientDoc1;

...

// then open the report

rpt.Load(rptName.ToString(), OpenReportMethod.OpenReportByTempCopy);

// then clone the report

rpt1 = (CrystalDecisions.CrystalReports.Engine.ReportDocument)rpt.Clone();

// this assigns the report to RAS for modification

rptClientDoc = rpt.ReportClientDocument;

rptClientDoc1 = rpt.ReportClientDocument;

Cloning does a Deep Copy.

I've never tried to load multiple reports this way so not sure what is going to happen. You should use threading to handle each report object.

Sorry no samples.

Don

Former Member
0 Kudos

Thank you very much, i just saw your answer, it looks that i did not see the email notification about your answer.

now our project is given to another team, but when i need this i will return to it.

Thanks a lot.

Regards.

Answers (1)

Answers (1)

Former Member

Hello,
I came over this question when searching for a way to load a rpt. file from a memory stream. I to think it is very strange that you do not have a overloaded method for the ReportDocument.load() function that accepts a Stream.

We are using the CrystalReports suite in multiple components with a common database. The rpt-files are stored in that database together with a variety of content for the reports.

In the year 2016 i think it is quiet stupid to have to save this rpt. byte [] to a temp file before I am able to load it into the report generator. Memory has become cheep, and it is in so many ways more clean to avoid handling temp files.

Feature request: An overloaded method for the ReportDocument.load() function that accepts a Stream.

DellSC
Active Contributor
0 Kudos

I wholeheartedly agree!

There is a place to "officially" request new features - http://ideas.sap.com.

I did some searching there and found this: Open report from memory using Java SDK : View Idea.  Yes, it's for the Java SDK, but I added a comment about having it for the .NET SDK as well.  You should go there and vote it up.  If you decide to add an idea specifically for the .NET SDK, please post the link to it back here.  I'll publicize it and we may get or from SAP to do so as well.  The more up votes an idea gets, the more likely it is that the development team will implement it.

-Dell

Former Member
0 Kudos

Thank you for the information about which channels to use in order to get this feature implemented  
I have now voted up the suggestion you linked to, and have created a corresponding suggestion for the .NET SDK: Possibility to load a rpt-file from memory using the .NET SDK : View Idea

-Håkon

DellSC
Active Contributor
0 Kudos

I have voted it up and tweeted it.  Hopefully it will get some traction.

-Dell