'VSTO Office Plugin || Embedding Word file as object in Word Document and Reading it
I am working on a project where I have to embed the content of the current word file as a word document in the current document. I don't want to save the original content of the doc file on the disk. SO case is I want to read the current document content, convert it to byte[] or memory stream, and then clear the content of the current doc file and then embed the memory stream as an object in the current doc file. For example: I have a document named "abc.docx" with some text and images in it. When the user presses the Save button then I want to read all the content of the abc.docx and clear it and embed the content into it as an object.
I am using C#, Visual Studio 2022, and Visual Studio Tools for Office Plugin. Any code sample or workflow suggestion will be helpful for me.
Update I was able to read the embeded object using Shape Object but it requires to activate the object else it gives null value. When we call the activate() method then it promts user with a dialog box to open or cancel. I don't want to show this dialog to user. Is there any way to supress this and get the object?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|