cancel
Showing results for 
Search instead for 
Did you mean: 

How to load report from a stream in VB.NET

Former Member

Hi All,

Is This any possibility to load report from a stream (not from file) ?

I know ExportToStream Method of ReportDocument class.

But This class dont have any method to load report from a stream,

only from file (Load Method)

Please help me

regards

Piotrunio

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Not possible

Answers (1)

Answers (1)

Former Member
0 Kudos

<p>I think that the only way is to put the stream into a file and then you can load the report from the file: </p><p>This function can help you: </p><p>using System.IO;</p><p>public void FileFromStream(string fileName, Stream stream)</p><p>{ </p><p> StreamWriter sw = new StreamWriter(fileName);</p><p> stream.Position = 0;<br /> byte[] buffer = new byte[stream.Length];<br /> int numBytesToRead = (int)stream.Length;<br /> int numBytesRead = 0;<br /> while (numBytesToRead > 0)<br /> {<br /> int n = stream.Read(buffer, numBytesRead, numBytesToRead);<br /> if (n == 0) break;<br /> numBytesRead += n;<br /> numBytesToRead -= n;<br /> }<br /> stream.Close(); </p><p> sw.Write(buffer, 0, numBytesRead);</p><p> sw.Close(); </p><p> } </p><p>&nbsp;</p><p>&nbsp;</p>

Former Member

Thanks for Your Help, but I know this method.

I want to bypass reports temporary files in HDD.

I don't want put any temporary files on HDD.

Is This possible ?

Reg

Piotrunio