How to paste metafile from Microsoft Word at expected size

Posted by Joel on Stack Overflow See other posts from Stack Overflow or by Joel
Published on 2010-04-20T15:31:28Z Indexed on 2010/04/20 15:33 UTC
Read the original article Hit count: 594

Filed under:
|
|

I'm having an issue in a WPF application using the RichTextBox where content being pasted in from Microsoft Word is mangled. To work around the issue, I found that Word includes a metafile on the clipboard, and I can get the metafile from the clipboard using interop (WPF wouldn't properly import the metafile either). My problem, though, is that a metafile is scalable and so whether a user pastes a whole page of content or a small amount, the metafile claims that its Width is 4390. However, if I strip the clipboard of everything but the metafile and paste it into MSPaint, the resulting bitmap in paint has properly scaled the pasted metafile, so it seems to me that there must be some information somewhere that indicates the real size. Does anyone know how to get the proper expected size of the Metafile?

© Stack Overflow or respective owner

Related posts about wpf

Related posts about metafile