Hi,
I tried to save my chart as EMF-File with
this.ultraChart1.SaveTo(sEMFFile, System.Drawing.Imaging.ImageFormat.Emf);
but it fails. It works with png, bmp and other formats, but not with emf or wmf. What am I doing wrong?
Thanks in advance.
Please look the attached example. There I suggest you two possible variants to save your image in EMF format. Please start the example and push both buttons, each of them will save the image in EMF format, but please look the code behide of each buttons.
In the internet formums has different oppinion about this issue. If you want look at:
In any way, please try my solution and if you have any questions, please ask me
Regards
Georgi
Hi Georgi,
thanks for the example, but I doubt whether the files the example create are real emf-files. Accourding to the microsoft-article, it is not. One file seems to be in bmp-format, the other in png-format.
A work around would be when there would be a possibility to copy the chart into the clipboard as EMF-format. Do you have information about that?
Thanks and Regards.
Thanks a lot. This sounds not very good.
An alternative for me would be: When there are annotations on a chart and the user should be able to move the annotations accourding his needs, I set the annotations as "dragable" (I saw this in the sample-project).
My question now is: For initial positions of the annotation, can I use the Ultrachart intelligence accourding collision detection and avoidance or do I have to position the annotation by my self?
Hi Grpesc,
There are few available options to save the image from our UltraChart into vector based graphics (for example *.emf or *.wmf).
If you choose the option by using clipboard, you could use the code below:
System.Windows.Forms.Clipboard.Clear(); ultraChart1.CopyToClipboard(); System.Windows.Forms.Clipboard.GetImage().Save("..\\..\\Test_1.emf", System.Drawing.Imaging.ImageFormat.Emf); or System.Windows.Forms.Clipboard.GetImage().Save("..\\..\\Test_1.wmf", System.Drawing.Imaging.ImageFormat.Wmf);
System.Windows.Forms.Clipboard.Clear();
ultraChart1.CopyToClipboard();
System.Windows.Forms.Clipboard.GetImage().Save("..\\..\\Test_1.emf", System.Drawing.Imaging.ImageFormat.Emf);
or
System.Windows.Forms.Clipboard.GetImage().Save("..\\..\\Test_1.wmf", System.Drawing.Imaging.ImageFormat.Wmf);
But as far as I know you will met some issue via this approach because the GDI+ component of the .NET Framework does not have an encoder that allows you to save files as WMF, EMF and the resulting file is saved as a Portable Network Graphics (PNG) file instead, nevertheless that file extension is WMF or EMF. More details about this you could find at http://support.microsoft.com/kb/316563
Other possible approach is to use the code below:
Image im; im = ultraChart1.Image; im.Save("..\\..\\Test_1.emf", System.Drawing.Imaging.ImageFormat.Emf); or im.Save("..\\..\\Test_1.wmf", System.Drawing.Imaging.ImageFormat.wmf);
Image im;
im = ultraChart1.Image;
im.Save("..\\..\\Test_1.emf", System.Drawing.Imaging.ImageFormat.Emf);
im.Save("..\\..\\Test_1.wmf", System.Drawing.Imaging.ImageFormat.wmf);
Please if you have any questions, do not hesitate to ask me
sorry for the big delay, but I wasn't sure whether this issue comes up accourding our project aquisition or not, but now I know it will.
Let me back up and explain what I want to do. I am working on a presentation tool which display several charts. The user sould be able to export a chart to an external presentation software, mainly Powerpoint. He should be able to adjust the chart in Powerpoint, e.g., moving or deleting the legend, move some annotations etc. I know that this is possible with vector based graphic types (like emf), but not with raster based graphic types (like bmp). Now I am wondering about whether it is possible to export a winchart (via clipboard or file) as vector based graphic.
Could you help me? Thanks in advance.
Hi again,
I am still following your issue. Have you been able to resolve it. Please keep me in touch
Hello again,
Yes, it is completely possible to cope the image from the ultraChart and then to save this image in a file using the System.Windows. Please use the code below:
System.Windows.Forms. Clipboard.Clear(); ultraChart1.CopyToClipboard(); System.Windows.Forms. Clipboard.GetImage().Save("D:\\Test_1.emf",System.Drawing.Imaging.ImageFormat.Emf);
System.Windows.Forms.
Clipboard.Clear();
Clipboard.GetImage().Save("D:\\Test_1.emf",System.Drawing.Imaging.ImageFormat.Emf);
Could you please tell me what is the reasons to think that the files from my first example are not in the emf format ? Please try the third suggestion (via CopyToClipboard) and please send me feedback.