I've a framework element that I'd like to insert as a vectorised image. For most of the objects I use http://xamltoys.codeplex.com/ to convert the element to an enhanced metafile that I put in a cell using Xls.AddImage(ms, properties). XAMLToys does a poor job for this particular framework element, but I can save it as a XPS.
Can I import the XPS file into a cell or is there another way to save a vectorised image in a cell?
Hi,
Sadly the only vectorial formats Excel supports are wmf and emf.
And so those are the ones we can support, FlexCel doesn't do any conversion, and if it was to do it, it would probably be no better than what dedicated tools like XAMLToys do.
Converting to a metafile is indeed tricky, it must be one of the worst file formats ever, but that's the only way to have a vector image in Excel. Any other format like XPS would have to be badly converted by someone (it might be FlexCel or XAMLToys of whatever) and stored as a metafile in the xls/x file, since that's the only thing allowed
Normally for complex things where a good metafile conversion can't be done, there is no other option than to use a raster format like png. I really wish Excel supported a nicer vector image format, but until they do, there is little we can do. It must be either a wmf, an emf, or some raster format.
Hi Adrian,
Long time no see.
I managed to create a wmf after all. This is what I did:
- Created an xps using XpsDocument
- Extracted the main doc in the xps (it is an xaml in this zip file; watch out for simple text blocks as Glyphs)
- Used xaml toys to create the wmf