on 04-04-2011 9:08 AM
Hi. I am trying to export to stream HTML text with the following code:
var reportDocument = new ReportDocument();
reportDocument.Load(Server.MapPath(test_rpt file));
reportDocument.SetDataSource(test_source);
MemoryStream stream;
stream = (MemoryStream)this.reportDocument.ExportToStream(ExportFormatType.HTML32);
StreamReader reader = new StreamReader(stream);
string report = reader.ReadToEnd();
reader.Close();
But get just empty string!!!
But if I am using
reportDocument.ExportToDisk(ExportFormatType.HTML32, path_to_html)
All is working fine! Please help me to understand what is wrong?
I've done more testing and I get the same. I believe the issue is because Streams are exported in a binary format whereas HTML is simple text. I don't think this will ever work, or work in CR.
Work around would be to use the ExporttoDisk option and then outside of CR stream the HTML files to the user using System.IO API's....
Thanks again
Don
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you don't want to save to local file system first and then stream the file outside of CR then that is your option. Adding 4 or 5 lines of extra code is not something considered a CR issue and that is the your work around. It works fine using any other Binary based file types.
This is by design. Add your enhancement request to [Idea Place|https://ideas.sap.com/community/products_and_solutions/crystalreports] if you feel it needs to be added.
Thank you
Don
See this thread for a sample:
http://forums.sdn.sap.com/click.jspa?searchID=71243409&messageID=9994532
Thank you
Don
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.