Profile Picture

Save chart control as image to stream

Posted By Elvira Aminova 12 Years Ago
Author
Message
Elvira Aminova
questionmark Posted 12 Years Ago
View Quick Profile
Junior Member

Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)

Group: Forum Members
Last Active: 10 Years Ago
Posts: 10, Visits: 1
Hi!

I'm trying to save chart control image to stream:

MemoryStream ms = new MemoryStream();
_chart_control.ImageExporter.SaveToStream(ms, new NEmfImageFormat());

But SaveToStream method throw NotSupportedException with message "Specified method is not supported".

Using other image formats such as NXamlImageFormat, NSvgImageFormat, doesn't produce this error.

What's happening with NEmfImageFormat?

Nevron Support
Posted 12 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009

Hi Elvira,

This issue has been fixed in one of the SPs - we just tested with version 12.2.6.12 with the following code:

NChart chart = nChartControl1.Charts[0];
MemoryStream stream = new MemoryStream();
nChartControl1.ImageExporter.SaveToStream(stream,
new NEmfImageFormat());
stream.Seek(0,
SeekOrigin.Begin);
FileStream fs = new FileStream("c:\\test.emf", FileMode.OpenOrCreate);
byte[] bytes = stream.ToArray();
fs.Write(bytes, 0, bytes.Length);
fs.Close();

and it works OK. In short you need to download the latest service pack and install it.

Let us know if you meet any problems.



Best Regards,
Nevron Support Team





Similar Topics


Reading This Topic