What Microsoft writes... only Microsoft reads.

What Microsoft writes... only Microsoft reads.

This caption triggers some unpleasant deja-vu. The latest example in my confined and restricted world is reading wmf files.

Some wmf-files of an "older sort" are not readable using the Delphi TMetaFile implementation. Specifically i needed to extract the thumbnails from OOXML files (docx, xmlsx, pptx).
It seems like these wmfs (when saved by office 2010 (2012?) and down) has a different header that does not even correspond to the specifications that indeed are out there.

Mucho frustrating. The lifesaver this time was http://www.bilsen.com/gdiplus/index.shtml. Unfortunately the MS library reads (paints?) a wmf much slower than Delphi (there might be some settings or tricks to amend this, though).
http://www.bilsen.com/gdiplus/index.shtml

Comments

  1. I seem to recall that there are three formats, WMF, EMF and EMF+ - which format gives you troubles?

    ReplyDelete
  2. 'Some wmf-files of an "older sort"'...  'Specifically i needed to extract the thumbnails from OOXML files (docx, xmlsx, pptx).
    It seems like these wmfs (when saved by office 2010'...

    ReplyDelete
  3. I guess you have to dive into the spec to identify the version, and the issues.  Perhaps it is possible to filter out content that is incompatible? 
    http://msdn.microsoft.com/en-us/library/cc250370.aspx

    ReplyDelete
  4. The point of the post was that using GdiPlus instead of the Delphi RTL is one solution to this problem. Sorry for not being clear enough.

    ReplyDelete
  5. Ah, LOL! :D
    My bad - you can blame the reader for being dense :D

    ReplyDelete
  6. Lars Fosdal Or those glasses...  ;)

    ReplyDelete

Post a Comment