I'm trying to put a chart into a report (Report Sharp Shooter) by exporting it into a metafile, but unfortunately the following code
Code: Select all
Steema.TeeChart.Export.MetafileFormat mff = this.tChart1.Export.Image.Metafile;
mff.Enhanced = true;
mff.Width = 800;
mff.Height = 600;
System.IO.MemoryStream stream = new System.IO.MemoryStream();
mff.Save(stream);
System.Drawing.Image image = System.Drawing.Image.FromStream(stream);
An unhandled exception of type 'System.ArgumentException' occurred in system.drawing.dll
Additional information: Invalid parameter used.
Unhandled Exception: System.ArgumentException: Invalid parameter used.
at System.Drawing.Image.FromStream(Stream stream, Boolean useEmbeddedColorManagement, Boolean validateImageData)
at TeeChartMetaFileExport.Form1.button2_Click(Object sender, EventArgs e) in d:\projects .net\teechartmetafileexport\form1.cs:line 227
It makes no difference if a MemoryStream or a FileStream is used. If the metafile is stored to the disk then it can be opend with the "Windows Image Viewer" without any problems.
Any help or workaround available?