none
OLE object asks for WMF instead of EMF in Word 2016, but not in Word 2013 or 2010 RRS feed

  • Question

  • We have made a program that makes charts available as OLE objects that can be embedded in Excel, Word and PowerPoint.

    This is nice since we can let the users update the charts with new settings and new data. It is used by thousands of our users. Most users have a lot of documents.

    Image quality is of essence. For this purpose we use EMF. WMF are more limited when it comes to things like fonts, line types and transparency. This has worked very well in the past.

    However, recently we have received some complaints from some of our users that the charts do not look nice when using Office 2016. Now we have investigated this further.

    When documents containing embedded charts created in older versions of Office are updated in Word 2016, then word will no longer ask for EMF, but for only WMF. This is not an issue if you create a new document in Word 2016 (as far as we know).

    This is what happens:

    - In Office 2010/2013 when you select "Refresh" of the chart (as you can do for embedded objects via the OLE mechanism in Office), Word will start by doing a IDataObject.QueryGetData and ask for TYMED.TYMED_ENHMF. Then it will do IDataObject.GetData and request TYMED.TYMED_ENHMF.

    - For the same document in Word 2016, there is no call to QueryGetData. Instead, only GetData is called and then TYMED.TYMED_MFPICT is requested.

    If I embed new charts, this will work in Word 2010-2016. Looking at the docx file, I can see a difference in the binary "embeddings" file. These are compound document files and there is a stream called "ObjInfo" that differs.

    For charts that works, it contains the data  00 00 03 00 0D 00 but for charts that do not work it contains  00 00 03 00 00 00

    I am pretty sure that this structure is documented here: https://msdn.microsoft.com/en-us/library/office/gg132420(v=office.14).aspx

    More specifically, the word that differs is documented here: https://msdn.microsoft.com/en-us/library/office/gg132373(v=office.12).aspx

    So, when it works in Word 2016, the flags are fEMF|fQueriedEMF|fStoredAsEMF. When it does not work in Word 2016 no flags are set. It is not documented what effect these flags really should have, but there is clearly that Word 2016 makes a different interpretation than Word 2010/2013.

    After some experimentation it seems to me that previous versions of Word will ask if EMF is supported when fQueriedEMF is not set and use EMF in that case. Word 2016 never asks. It just assumes that if the format is unknown, then WMF should be used.

    This is very unfortunate since this will ruin many thousands of documents for our clients.

    Is this a well-known issue? Is there somethings we can do to resolve this that does not incur a lot of manual work for all our clients? Right now we will have to ask them not to upgrade Office.

    Tuesday, April 4, 2017 1:25 PM

All replies

  • Actually, the communication is not exactly as I wrote.

    When Verb is activated (such as open), then Word will first call

    IDataObject.DAdvise and specify TYMED_MFPICT

    then IOleObject.DoVerb is called.

    We then notify Word of any changes by sending the data in the format that has been requested by calling IAdviseSink.

    Tuesday, April 4, 2017 2:15 PM
  • Hello,

    Thanks for posting here. This forum is for discussing development issues related to Word object model.

    According to your description, I think your issue is related to Office Binary File Formats, I suggest you post on Office XML, ODF, and Binary File Formats forum for further support. Thanks for your understanding.

    Regards,

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, April 5, 2017 3:16 AM
    Moderator
  • This is not about the file format. This is how the OLE API in Word 2016 works differently than older versions of Office for certain documents.

    /Thomas O

    Wednesday, April 5, 2017 5:47 AM
  • Thanks for detailed information.

    >> We have made a program that makes charts available as OLE objects that can be embedded in Excel, Word and PowerPoint.

    To check whether it is related with Code issue, could you try to make charts manually in Office 2010/2013 version, and try to open it in Office 2016 to see whether this issue still exist?

    >> These are compound document files and there is a stream called "ObjInfo" that differs.For charts that works, it contains the data  00 00 03 00 0D 00 but for charts that do not work it contains  00 00 03 00 00 00

    I try to make a chart manually under Word 2016, but I did not find any ObjInfo, could you share us how did you get it? Is it read-only? Could you set the value by right data? I suggest you check the value in Office 2010. It seems the ObjInfo missed when upgrading old documents to Word 2016. 


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, April 5, 2017 8:36 AM
  • This is a "code" issue. Word 2016 clearly behaves differently than earlier versions when it interacts with OLE objects in certain document created by older versions of Word.

    Since few programs use OLE these days I fear that the knowledge of how this works is limited.

    Office used to use that when embedding charts from Excel, but these days it seems to work differently. You can still see embedded objects if you add an object of type "Microsoft equation editor 3.0". You will then see an item called "word\embeddings\oleObject1.bin" in the docx file. This binary file is a "compound ole document file" and contains a stream called "ObjInfo".

    My issue here is not with the file format as such, but rather how different versions of Word behaves differently.

    Although, it would be interesting to know how a Word document can end up with "00" for these flags in the document in the first place. I do not have a way to reproduce that, but we receive such documents from our clients.

    The chances that there will be someone out there that knows the inner workings of OLE in Word is probably very low. And I fear that they do not read forums like this.

    Wednesday, April 5, 2017 9:15 AM
  • >>And I fear that they do not read forums like this.

    Yeah, you are right. And it is sad there is no internal channel for us to contact them directly.

    For your issue, as you know, it is more related with depth implementation of OLE object in different version. But, it is so less information about this on Internet.

    We hope we could think out any work around for you.

    1. Could you modify ObjInfo?

    2. If you copy the content from Word 2010 to Word 2016, will this issue still exist in new Word 2016 file? 


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, April 5, 2017 9:26 AM
  • Copying objects do not help. This info is preserved.

    In theory it is possible to write some form of utility that "adjusts" the docx files, but we have thousands of users were each user have a lot of documents. These are typically banks, financial institutions and big companies, so they should be important users for Microsoft too. Right now, we need to recommend our users not to upgrade to Office 2016.

    I regard this as a bug in Word 2016, but it is not easy to get such things reported and even harder to get things fixed.

    /Thomas O

    Wednesday, April 5, 2017 9:47 AM
  • I will suggest you contact the Microsoft professional support so that our engineers can work closely with you to troubleshoot this issue.

    If the support engineer determines that the issue is the result of a bug the service request will be a no-charge case and you won't be charged. 

    For creating an incident, I suggest you try below steps.

    1. Open https://support.microsoft.com/en-my 

    2. Get More support->Developers

    3. Developers->Visual Studio, Microsoft imagine, BizSpark and WebsiteSpark->Microsoft Technical Support

    4. Select Office->Word 2016

    5. Select the third option I use it as an IT Professional, developer or Microsoft partner->Next

    6. Create an incident->Programming and Extensibility->Outlook Object Model(OOM)

    7. Start request

    Hope it will help.

    Best Regards,

    Edward


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, April 6, 2017 2:11 AM
  • Yes, that is probably what I need to do.

    (I have opened many support requests over the year and never paid for it since they has always been bugs ;-). Unfortunately, the end result has often been, "yes it is a bug, but we will not fix it". )

    Thursday, April 6, 2017 6:25 AM
  • It would be appreciated if you could share us the result from Microsoft professional support.

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, April 6, 2017 6:28 AM