Readerwmf, Clipboard and Visio
we use Ab2d.ReaderWmf.dll in 5.4.4299.36701 version, in an WPF Application, by the method GetGeometryFromHemf.
When we copy an object from Visio 2010 (Airport Symbol for example), and paste into this WPF Application, this App crashes with the exception:
"FileFormatException : Unknown file format! Ab2d.ReaderWmf can read only valid metafiles.
Pile d'appel :
at ?.?.?(IntPtr ?)
at Ab2d.ReaderWmf.GetGeometryFromHemf(IntPtr hemf, GeometrySettings settings)
at ... (our code) "
Have you ever seen this problem before ? Is this problem resolved in most recent version of Readerwmf ?
The code used in WPF App is :
ReaderWmf metafileReader = new ReaderWmf();
Metafile metafileImage = null;

IDataObject iData = Clipboard.GetDataObject();
if (iData.GetDataPresent(DataFormats.EnhancedMetafile))
metafileImage = (Metafile)iData.GetData(DataFormats.EnhancedMetafile);

IntPtr hEmf = metafileImage.GetHenhmetafile();

Image myImage = metafileReader.GetGeometryFromHemf(hEmf, GeometrySettings.BasicOptimization);
myImage.Stretch = Stretch.Fill;

string xamlStr = string.Empty;

StringBuilder sb = new StringBuilder();
TextWriter tw = new StringWriter(sb);
XmlTextWriter xw = new XmlTextWriter(tw);
xw.Formatting = Formatting.Indented;

if (myImage != null)
XamlWriter.Save(myImage, xw);
xamlStr = sb.ToString();

Thanks for your responses.

Messages In This Thread
Readerwmf, Clipboard and Visio - by acaptcha2 - 01-05-2016, 12:27 PM
RE: Readerwmf, Clipboard and Visio - by abenedik - 01-05-2016, 09:33 PM

Forum Jump:

Users browsing this thread:
1 Guest(s)