I am writing code witch updates content of embedded .xlsx file into docx file.
After updated document is saved, the .emf file - graphical snapshot of embedded spreadsheet, displayes old data when I open document in word.
What I need is make word to display updated data just after document is open.
Is it possible to force word to recreate .emf file after document is open, so user doesn't need to double click embedded object to save it?
I've tried to delete image file, but it doesn't cause word to recreate image - then word displayes message saying object cannot be displayed.
Deleting r:id="rId5" attribute from imagedata tag of this embedded object also doesn't work.
Can someone help me?
OpenXml cannot be used to create images. But off-course it can be used to update the existing images, So, in your case use any other third party tool to create the image of the updated excel and then using open xml, update the image.
I tought maybe it is possible to add attribute to OLEObject node in document indicating image should be recreated by word application. I've found such attribute for linked object in specification, but what about embedded object?
As I understand it, the problem is that you have no easy way to create a new image of the embedded object and there is no way to force Word to do it. My only suggestion is to try replacing the incorrect image with your own image that gives instructions on how to update the image in Word or maybe just says, "Embedded Spreadsheet - Image not available."