Вопрос

Powerpoint file is actually a zip file that contains xml sub-files. These sub-files illustrate all the properties of objects of every slides (e.g., position, color, animation, etc.). You can convert the pptx file into zip file and unzip it you will see sub xml files.

Now, I want to create a Powerpoint Add-in application, allowing me to add more information to a specific object, and store dynamically it in itself XML file (or when saving file as). For example, my Add-in PowerPoint application contains a button named "Flippable". When I select a specific object of a slide, and select "Flippable", my application will find the xml file that contains the object information, and add a tag "Flippable = true".

Is it possible to do that dynamically when running application? Thanks

Это было полезно?

Решение

Why go to all the effort of cracking and parsing the XML file, assuming that you even can while he presentation's open in PPT, especially since you're already doing this from an add-in?

You mentioned that the user has selected a shape. Why not just tag the shape:

With ActiveWindow.Selection.ShapeRange(1)
  .Tags.Add "Flippable", "Yes"
End With

You'd want a bit more code around that to make sure that there IS a selection, and if you want to allow tagging multiple shapes at one time, you'd need to put in inside a For Each/Next loop.

Then assuming a reference to the current shape to be tested in oSh

If oSh.Tags("Flippable")="Yes" Then
   ' Do your stuff
End If
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top