问题
I've read a lot about editing pptx files with OpenXml like
PresentationDocument presentationDocument = PresentationDocument.Open("C:\\Users\\beggers\\Desktop\\Test.pptx", true)
But how can I modify the XML data of my slides/presentation on runtime? Specialy when I run a new presentation witch is not saved.
I am working on a C# VSTO Add-in and I want to modify my slide/xml in a way, which is not supportet by Microsoft.Office.Interop.
回答1:
Unfortunately, Microsoft Word is the only Office application that offers an Interop API for reading and even writing Open XML markup, in that case of a given Range
object (which can also be the Range
representing the whole main document part). Neither Excel nor PowerPoint provides that capability.
Even Microsoft Word does not give you the full markup, though, meaning you can't read or change every aspect of the opened document by reading or making changes to the Open XML markup. Thus, depending on what you would like to do with your document, you will have to close and reopen even Word documents to access and process the full Open XML markup.
来源:https://stackoverflow.com/questions/59293193/vsto-openxml-c-sharp-edit-powerpoint-on-runtime