Is it possible to use the Open XML sdk to manipulate parts of document which is currently open in the Office app (word/ppt). I know the easiest thing is to use VSTO, but its slow and would involve clipboard use to insert elements, the OXML sdk is direct and simpler.
If somebody could post some code sample that would be great.
Thanks in advance
Rakesh
The Open XML SDK 2.5 simplifies the task of manipulating Open XML packages and the underlying Open XML schema elements within a package. The Open XML SDK 2.5 encapsulates many common tasks that developers perform on Open XML packages, so that you can perform complex operations with just a few lines of code.
#1) Open Windows Explorer and browse to the location where the XML file is located. We have browsed to the location of our XML file MySampleXML as seen below. #2) Now right-click over the file and select Open With to choose Notepad or Microsoft Office Word from the list of options available to open the XML file.
Today MS Open Tech has announced the release of the Open XML SDK version 2.5 as open source software (Apache 2.0 license) under the stewardship of the . NET Foundation.
Go to your Solution Explorer > right click on references and then click Manage NuGet Packages . Then search in tab "Online" for DocumentFormat. OpenXml and install it. After you can use DocumentFormat.
Yes it is possible to modify an open VSTO document, using the OpenXML sdk 2, then update your open document using the changed xml.
http://msdn.microsoft.com/en-us/library/ff191178.aspx
http://code.msdn.microsoft.com/Improve-Automation-415bff13
Basically you get the xml from a range, treat it as a stream, package it up, use the sdk on the package, then insert the modified xml back by reversing the process.
The wisdom out there is that this common sense usage of the sdk is not possible. However, this is just wrong.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With