Using Perspector XML
This page describes how to create Perspector images with XML.
How Perspector data is stored
Perspector images are held in PowerPoint picture shapes. Shapes with Perspector images have additional information that describe the image so that it can be edited using Perspector. This information is stored as XML in tags with the name "perspector-data".
For more about XML, read this Wikipedia entry.
The Perspector XML on a PowerPoint shape can be accessed using this VBA:
sh.Tags("perspector-data")
where sh is the PowerPoint shape.
The XML data model
The XML data model used by Perspector is described in this reference document:
Perspector XML Data Model
This document describes all of the XML elements and attributes used by Perspector.
How to make an image from XML
These steps can be used to create a Perspector image from XML:
- Create a PowerPoint shape without a line.
- Create a tag on the shape named "perspector-data" with the XML as data. This has to be done using a programming language such as VBA because tags cannot be edited using PowerPoint, but see below for a macro that makes this step easier.
- Select the shape in PowerPoint.
- Click Update Perspector Frame on the Perspector add-in toolbar within PowerPoint, or edit the shape as a regular Perspector image.
To make this easier, you can use the macro in this presentation. The macro performs the first 3 steps using a file you select as the XML source. Instructions are contained in the presentation.
Example
The following XML describes a shiny, blue, up-pointing cone positioned to the right of the frame's center. See the XML Data Model for a description of the elements and attributes.
<Perspector majorVersion="1" minorVersion="400">
<Scene>
<Shape id="0" type="UpCone">
<Position position="50,0,0" size="100,200,100"/>
<DisplayProperties>
<Fill color="#00007f" />
<Shine shininess="90" />
</DisplayProperties>
</Shape>
</Scene>
</Perspector>
You can download this XML and use the macro above to create the example image.
|