Providing WPF Visualization to WMF / EMF File

I am working on a WPF chart component. I need to implement the Chart Visual rendering function for a metafile (WMF / EMF) so that the user can embed this file in any office product, such as Word or Powerpoint, and resize the file without affecting the quality of the displayed image.

I saw some similar questions about this here, but none of them provide any useful answers.

I learned from some posts that WPF does not support rendering visualization for EMF / WMF due to security issues, but there must be some kind of replacement for it that should allow interoperability, such as EMF / WMF, for Winform-based applications and office suit or ms-paint.

Any suggestions for moving forward are welcome, thanks.

+7
source share
3 answers

Yes, xps printing is fine, but you wanted to get into the metafile, no? Just saw this, which can help look at a very low set of links.

Does WPF support reading / writing WMF / EMF files natively?

It seems these 2 links may be of interest

http://softronix.com/download/WpfToWmfClipboard.zip

http://xamltoys.codeplex.com/

+3
source

I would think what you want to do is use the RenderTargetBitmap class to first get an image of your control and then convert that to EMF.

Actually this blog post gives you a good starting point: http://www.switchonthecode.com/tutorials/wpf-tutorial-getting-from-wpf-to-a-metafile-and-onto-the-clipboard

However, since you are working with BMP (this is what you get from WPF), the resulting image will not be based on the vector, even if you manage to save it as an EMF file.

Go I hope this helps you in some way.

+1
source

I have a solution for this, I used XamlToys to convert the visual image to Emf, the following steps to achieve this: Get the Framework element. Convert it to XPS Then convert it to XamlStream And then convert it to EMF using XamlToys. It works well and provides high quality EMF.

Give it a try and let me know if that helps.

+1
source

All Articles