getting 'System.IO.InvalidDataException' while loading byte array to the report

Stimulsoft Reports.WPF discussion
Post Reply
snair
Posts: 3
Joined: Mon Oct 04, 2010 3:37 pm
Location: U.S

getting 'System.IO.InvalidDataException' while loading byte array to the report

Post by snair »

Am getting below exception error while trying to load a byte array to the report. Please let me know how can I resolve the problem. Appreciate a help

Exception Error
An unhandled exception of type 'System.IO.InvalidDataException' occurred in Stimulsoft.Report.dll
Additional information: The magic number in GZip header is not correct. Make sure you are passing in a GZip stream.

Here is the code snippet am using..
System.Windows.UIElement element = (System.Windows.UIElement)this.ImageCanvas.cadImage; (P.S : this is an image)
buffer = element.ToBitmap(15, 15).ToPNGBytes();
StiReport report = new StiReport();
report.Load(buffer);
report.ShowWithWpf();


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

getting 'System.IO.InvalidDataException' while loading byte array to the report

Post by Alex K. »

Hello,

Maybe we did not exactly understand your question.
Method report.Load() loads a report template, and you try to load an image instead of it (as we understand from your code).
Could you explain your issue in more details?

Thank you.
snair
Posts: 3
Joined: Mon Oct 04, 2010 3:37 pm
Location: U.S

getting 'System.IO.InvalidDataException' while loading byte array to the report

Post by snair »

Report Load function takes byte array or stream type parameters... so i was thinking an image can be loaded like that
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

getting 'System.IO.InvalidDataException' while loading byte array to the report

Post by Alex K. »

Hello,

You can create a report, place an image on it, load the image into the report using the code and with the help of the report.Load() to load the report.

Thank you.
Post Reply