DocumentPropertiesBase Class
The base class for document properties.
Declaration
public abstract class DocumentPropertiesBase extends OfficeObject
Remarks
The DocumentPropertiesBase class introduces core document properties and the getCustomProperties() method that returns custom document properties. The DocumentAppProperties descendant adds application properties.
Call the Presentation.getDocumentProperties() method to access document properties of a presentation.
PDF Export Metadata
When you export a presentation to PDF, the API can write the document author (getAuthor()), title (getTitle()), subject (getSubject()), and keywords (getKeywords()) to PDF document metadata. To specify the metadata source, call the PdfExportOptions.setMetadataExportMode(value) method.
Refer to the following help topic for additional information: Read and Modify Presentation Document Properties.
Inherited Members
Inheritance
Methods
getAuthor() Method
Returns the document author.
Declaration
public String getAuthor()
Returns
| Type | Description |
|---|---|
| String | The author name. |
getCategory() Method
Returns the document category.
Declaration
public String getCategory()
Returns
| Type | Description |
|---|---|
| String | The category name. |
getContentStatus() Method
Returns the document content status (for example, Draft, Reviewed, or Final).
Declaration
public String getContentStatus()
Returns
| Type | Description |
|---|---|
| String | The content status. |
getCreated() Method
Returns the document creation date and time.
Declaration
public Instant getCreated()
Returns
| Type | Description |
|---|---|
| Instant | The creation date and time. |
getCustomProperties() Method
Returns custom document properties.
Declaration
public IDocumentCustomPropertyDictionary getCustomProperties()
Returns
| Type | Description |
|---|---|
| IDocumentCustomPropertyDictionary | A map of custom property names and values. |
Remarks
A custom document property has a name (a map key) and a value (DocumentCustomProperty). Call the put method of the returned map to add a custom property.
To create a custom property, call a DocumentCustomProperty constructor with a value parameter.
Example: Add Custom Document Properties to a Presentation
The following code snippet adds custom properties to the presentation metadata and saves the presentation to a file:
import java.io.*;
import java.math.BigDecimal;
import java.nio.file.*;
import java.time.Instant;
import com.devexpress.docs.office.*;
import com.devexpress.docs.presentation.*;
public class Main {
public static void main(String[] args) throws Exception {
try (Presentation presentation = new Presentation()) {
IDocumentCustomPropertyDictionary customProperties =
presentation.getDocumentProperties().getCustomProperties();
// Add custom properties to the dictionary.
customProperties.put("Project", new DocumentCustomProperty("Apollo"));
customProperties.put("Approved", new DocumentCustomProperty(true));
customProperties.put("Review Date", new DocumentCustomProperty(Instant.now()));
customProperties.put("Revision Count", new DocumentCustomProperty(5));
customProperties.put("Completion", new DocumentCustomProperty(0.75));
customProperties.put("Budget", new DocumentCustomProperty(new BigDecimal("12500.50")));
Files.createDirectories(Path.of("output"));
try (OutputStream output = Files.newOutputStream(Path.of("output", "Document.pptx"))) {
presentation.save(output);
}
}
}
}
getDescription() Method
Returns a short description of the document content.
Declaration
public String getDescription()
Returns
| Type | Description |
|---|---|
| String | The content description. |
getDocumentRevision() Method
Returns the document revision number.
Declaration
public String getDocumentRevision()
Returns
| Type | Description |
|---|---|
| String | A string that contains a non-negative whole number (for example, |
getDocumentVersion() Method
Returns the document version number.
Declaration
public String getDocumentVersion()
Returns
| Type | Description |
|---|---|
| String | A string that contains a non-negative whole number (for example, |
getKeywords() Method
Returns keywords associated with the document.
Declaration
public String getKeywords()
Returns
| Type | Description |
|---|---|
| String | Document keywords. |
getLastModifiedBy() Method
Returns the name of the user who last modified the document.
Declaration
public String getLastModifiedBy()
Returns
| Type | Description |
|---|---|
| String | The user name. |
getModified() Method
Returns the date and time when the document was last saved.
Declaration
public Instant getModified()
Returns
| Type | Description |
|---|---|
| Instant | The date and time of the last save operation. |
getPrinted() Method
Returns the date and time when the document was last printed.
Declaration
public Instant getPrinted()
Returns
| Type | Description |
|---|---|
| Instant | The date and time of the last print operation. |
getSubject() Method
Returns the document subject.
Declaration
public String getSubject()
Returns
| Type | Description |
|---|---|
| String | The document subject. |
getTitle() Method
Returns the document title.
Declaration
public String getTitle()
Returns
| Type | Description |
|---|---|
| String | The document title. |
setAuthor(String value) Method
Sets the document author.
Declaration
public void setAuthor(String value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | String | The author name. |
setCategory(String value) Method
Sets the document category.
Declaration
public void setCategory(String value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | String | The category name. |
setContentStatus(String value) Method
Sets the document content status (for example, Draft, Reviewed, or Final).
Declaration
public void setContentStatus(String value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | String | The content status. |
setCreated(Instant value) Method
Sets the document creation date and time.
Declaration
public void setCreated(Instant value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | Instant | The creation date and time. |
Remarks
When you create a presentation, the API sets the creation date to the current date (midnight in the local time zone). The API does not modify the creation date when you save the document.
setDescription(String value) Method
Sets a short description of the document content.
Declaration
public void setDescription(String value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | String | The content description. |
setDocumentRevision(String value) Method
Sets the document revision number.
Declaration
public void setDocumentRevision(String value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | String | A string that contains a non-negative whole number (for example, |
Exceptions
| Type | Description |
|---|---|
| ArgumentException | Thrown if the |
Remarks
If you call the setDocumentRevision(null) method, the getDocumentRevision() method returns an empty string.
The API does not update the revision number when you modify or save the document.
setDocumentVersion(String value) Method
Sets the document version number.
Declaration
public void setDocumentVersion(String value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | String | A string that contains a non-negative whole number (for example, |
Exceptions
| Type | Description |
|---|---|
| ArgumentException | Thrown if the |
Remarks
If you call the setDocumentVersion(null) method, the getDocumentVersion() method returns an empty string.
To specify the version of the application that created the document, call the DocumentAppProperties.setVersion(value) method.
setKeywords(String value) Method
Sets keywords associated with the document.
Declaration
public void setKeywords(String value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | String | Document keywords. |
setLastModifiedBy(String value) Method
Sets the name of the user who last modified the document.
Declaration
public void setLastModifiedBy(String value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | String | The user name. |
Remarks
When you save the document, the API resets the user name to an empty string.
setModified(Instant value) Method
Sets the date and time when the document was last saved.
Declaration
public void setModified(Instant value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | Instant | The date and time of the last save operation. |
Remarks
When you create a presentation, the API sets the modification date to the creation date. When you save the document, the API replaces the modification date with the current date and time.
setPrinted(Instant value) Method
Sets the date and time when the document was last printed.
Declaration
public void setPrinted(Instant value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | Instant | The date and time of the last print operation. |
Remarks
The API does not modify the print date when you save the document.
If the document does not contain a print date (for example, a new presentation), the getPrinted() method returns 0001-01-01T00:00:00Z.
setSubject(String value) Method
Sets the document subject.
Declaration
public void setSubject(String value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | String | The document subject. |
setTitle(String value) Method
Sets the document title.
Declaration
public void setTitle(String value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | String | The document title. |