Click here to Skip to main content
15,895,799 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Is there a way of loading byte array as ReportDocument without having to save it and use its location?

Details:

Let's say I have saved rpt file in ByteArray in database table, I wish to use the ReportDocument.Load() method to load the byte array object.


Is that doable, or do I have to save that object as a RPT file, then load it using the server path.

What I have tried:

C#
ReportDocument Report = new ReportDocument();
ReportInfoModel objReportDetailModel = manager.GetReportData(repid, userID);
string reportSavePath = Server.MapPath("~/Areas/DrillDownReport/" + objReportDetailModel.reportName);
File.WriteAllBytes(reportSavePath, objReportDetailModel.reportData);
Report.Load(Server.MapPath("~/Areas/DrillDownReport/" + objReportDetailModel.reportName));
CRViewer.ReportSource = Report;
Posted
Updated 17-Jun-21 5:43am
v2
Comments
Richard MacCutchan 17-Jun-21 3:39am    
What happens when you try it?

1 solution

Above code is working fine. I don't want to save file and use server.mappath.

I want to load byte array object .
 
Share this answer
 
Comments
Richard MacCutchan 17-Jun-21 12:02pm    
Then try it and see what happens.
megharani 23-Jun-21 21:49pm    
How can we do it without saving file on system? Please provide any solution.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900