Managing Presentation Properties
Microsoft PowerPoint provides a feature to add some properties to the presentation files. These document properties allow some useful information to be stored along with the documents (presentation files). There are two kinds of document properties as follows
- System Defined (Built-in) Properties
- User-Defined (Custom) Properties
Built-in properties contain general information about the document like document title, author’s name, document statistics and so on. Custom properties are those ones, which are defined by the users as Name/Value pairs, where both name and value are defined by the user. Using Aspose.Slides for Java, developers can access and modify the values of built-in properties as well as custom properties.
Managing Document Properties Using MS PowerPoint
Microsoft PowerPoint 2007 allows managing the document properties of the presentation files. All you have to do is to click the Office icon and further Prepare | Properties | Advanced Properties menu item of the Microsoft PowerPoint 2007 as shown below:
|Selecting Advanced Properties menu item||**|
|After you select Advanced Properties menu item, a dialog would appear allowing you to manage the document properties of the PowerPoint file as shown below in the figure:|
|In the above Properties Dialog, you can see that there are many tab pages like General, Summary, Statistics, Contents and Custom. All these tab pages allow configuring different kinds of information related to the PowerPoint files. Custom tab is used to manage the custom properties of the PowerPoint files.|
Working with Document Properties Using Aspose.Slides for Java
As we have described earlier that Aspose.Slides for Java supports two kinds of document properties, which are Built-in and Custom properties. So, developers can access both kinds of properties with the use of Aspose.Slides for Java API. Aspose.Slides for Java provides a class IDocumentProperties that represents the document properties associated with a presentation file through Presentation.DocumentProperties property.
Developers can use IDocumentProperties property exposed by Presentation object to access the document properties of the presentation files as described below:
Accessing Built-in Properties
These properties as exposed by IDocumentProperties object include: Creator (Author), Description, Keywords Created (Creation Date), Modified Modification Date, Printed Last Print Date, LastModifiedBy, Keywords, SharedDoc (Is shared between different producers?), PresentationFormat, Subject and Title
Modifying Built-in Properties
Modifying the built-in properties of presentation files is as easy as that of accessing them. You can simply assign a string value to any desired property and the property value would be modified. In the example given below, we have demonstrated how we can modify the built-in document properties of the presentation file using Aspose.Slides for Java.
This example modifies the built-in properties of the presentation that can be viewed as shown below:
|Built-in document properties after modification||**|
Accessing and Modifying Custom Properties
Aspose.Slides for Java also allows developers to access the values of custom properties. An example is given below that shows how can you access and modify all of these custom properties for a presentation.
This example modifies the custom properties of the PPTX presentation. Following figures show the presentation custom properties before and after modification:
|Custom Properties before Modification||**|
|Custom Properties after Modification||**|
Check if Presentation is Modified or Created
Aspose.Slides for Java provides the facility to check if a presentation is modified or created. An example is given below that shows how to check if the presentation is created or modified.
Export BLOB from Presentations
Aspose.Slides for Java provides a facility to Export large files (audio and video file in that case). We want to extract these files from the presentation and do not want to load this presentation into memory to keep our memory consumption low. Here is an example is given below how we can export BLOB from presentations in Java.
Add BLOB into Presentations
Aspose.Slides for Java provides a facility to add large files (video file in that case) and prevent a high memory consumption. An example is given below that shows how to add BLOB in presentations using Java.
Add Image as BLOB in Presentation
This example demonstrates how to include the large BLOB (image) and prevent a high memory consumption.
Adding Custom Document Properties
Aspose.Slides for Java also allows developers to add the custom the values for presentation Document properties. An example is given below that shows how to set the custom properties for a presentation.
|Custom Document Properties Added||**|
Working with Advanced Document Properties
The two new methods ReadDocumentProperties and UpdateDocumentProperties have been added to IPresentationInfo interface. They provide quick access to document properties and allow to change and update properties without loading a whole presentation.
The typical scenario load the properties, change some value and update the document can be implemented in the following way:
There is another way to use properties of a particular presentation as a template to update properties in other presentations:
A new template can be created from scratch and then used to update multiple presentations:
Support for adding EMZ image to Images collection
Aspose.Slides for Java provides a facility to embed EMZ file inside a presentation images collection. An example is given below that shows how to add EMZ image to images collection.