none
How do I tell an OLE object to re-render? RRS feed

  • Question

  • Hi;

    For the case of a DOCX/PPTX/XLSX embedded as an OLEObject in a DOCX/PPTX/XLSX, I am able to update the embedded document with no problem. However, the .EMF rendering of the object is what is still displayed (right now I'm working on Word with a worksheet embedded).

    How can I have it re-render the .WMF when the file is opened? If I remove the shapetype & shape elements leaving just the OLEObject, then nothing renders. If I set updateFields = true then the first object re-renders, but not any subsequent ones. Plus in that case I get a prompt.

    ??? - thanks - dave


    What we did for the last 6 months - Made the world's coolest reporting & docgen system even more amazing

    Friday, April 13, 2018 7:21 PM

Answers

  • Hi Dave

     

    Thanks for your patience as I investigated your question about how embedded OLE object static rendering images can be updated in the containing document.

     

    Focusing strictly on the Office applications of Excel, PowerPoint and Word. The embedded OLE object static rendering image of an Office associated document is only updated upon the closing and subsequent saving of the embedded OLE object by the Office application. The only way to cause the regeneration of the static rendering image of the embedded OLE object by the associated Office application is to open the embedded OLE object in the application. You can use a number of means to automate the opening, closing and subsequent saving of the embedded OLE object, Ole Automation, Process spawning and management, and Scripting. A number of these options do allow for background processing. However, all require that the associated Office applications are installed on the machine performing the automation process.

     

    In your specific environment, because you are able to parse and render the document formats, you also have the option of performing a rendering after you have updated the embedded OLE object and in addition to saving the updated document, to save an updated static rendering in the OLE Object’s PresentationObject structure as defined in [MS-OLEDS]: Object Linking and Embedding (OLE) Data Structures (https://msdn.microsoft.com/en-us/library/dd942265.aspx) Sections 2.2 (OLE Version 1.0) and 2.3 (OLE Version 2.0)

     

    Will Gregg| open specifications


    • Marked as answer by DavidThi808 Thursday, May 10, 2018 2:40 PM
    Thursday, May 10, 2018 12:09 AM
    Moderator

All replies

  • Hi David,

    Thank you for your question.  An engineer will contact you soon.


    Bryan S. Burgin Senior Escalation Engineer Microsoft Protocol Open Specifications Team

    Friday, April 13, 2018 8:51 PM
    Moderator
  • Hi Dave,

    Thanks for raising your question about how to cause an embedded object to regenerate it's associated WMF representation. 

    A quick clarifying question about your scenario. When the embedded document is opened for editing. Are you opening it within your OpenXml Render? Or are you allowing OLE to spawn an Excel instance and opening it within Excel? 

    I just want to make sure I have the scenario clear before I jump into the investigation for you.

    Sincerely,
    Will Gregg | open specifications

    Saturday, April 14, 2018 2:38 AM
    Moderator
  • Hi Will;

    Let me explain. We have a reporting product where Word/Excel/PPT are used to create the template for a report. So say we have a DOCX file with an XLSX file embedded in it. We parse the DOCX file, and the XLSX file, substitute in our data where specified, and then write out the populated document as a DOCX with an embedded XLSX, each of which has the new content.

    But we don't update the .EMF file that is the rendering of what the embedded XLSX file looks like. So in the DOCX, if you open or edit the embedded XLSX you'll see the new content. But until you do, you have the old "screen shot" (.EMF) of the XLSX being displayed where it is embedded.

    What I want is for Word (and Excel & PPT), when they open the document, to re-render the .EMF for each embedded object.

    thanks - dave


    What we did for the last 6 months - Made the world's coolest reporting & docgen system even more amazing

    Saturday, April 14, 2018 12:36 PM
  • Hi Dave,

    Thanks for clarifying the scenario for me. I will look into this and see what is possible to do to cause a an updating of the WMF file.

    WIll Gregg | open specifications

    Saturday, April 14, 2018 1:27 PM
    Moderator
  • Hi Will;

    Any luck yet?

    thanks - dave


    What we did for the last 6 months - Made the world's coolest reporting & docgen system even more amazing

    Monday, April 30, 2018 7:50 PM
  • Hi Dave

     

    Thanks for your patience as I investigated your question about how embedded OLE object static rendering images can be updated in the containing document.

     

    Focusing strictly on the Office applications of Excel, PowerPoint and Word. The embedded OLE object static rendering image of an Office associated document is only updated upon the closing and subsequent saving of the embedded OLE object by the Office application. The only way to cause the regeneration of the static rendering image of the embedded OLE object by the associated Office application is to open the embedded OLE object in the application. You can use a number of means to automate the opening, closing and subsequent saving of the embedded OLE object, Ole Automation, Process spawning and management, and Scripting. A number of these options do allow for background processing. However, all require that the associated Office applications are installed on the machine performing the automation process.

     

    In your specific environment, because you are able to parse and render the document formats, you also have the option of performing a rendering after you have updated the embedded OLE object and in addition to saving the updated document, to save an updated static rendering in the OLE Object’s PresentationObject structure as defined in [MS-OLEDS]: Object Linking and Embedding (OLE) Data Structures (https://msdn.microsoft.com/en-us/library/dd942265.aspx) Sections 2.2 (OLE Version 1.0) and 2.3 (OLE Version 2.0)

     

    Will Gregg| open specifications


    • Marked as answer by DavidThi808 Thursday, May 10, 2018 2:40 PM
    Thursday, May 10, 2018 12:09 AM
    Moderator
  • Hi Will;

    Thank you for diving in to this. I was hoping for something easier but we can make this work. And knowing what to do is gigantic.

    thanks - dave


    What we did for the last 6 months - Made the world's coolest reporting & docgen system even more amazing

    Thursday, May 10, 2018 2:40 PM