PresentationInspectOptions Class
Lists values that specify the presentation content categories to inspect before sanitization.
Declaration
public final class PresentationInspectOptions extends IntEnum<PresentationInspectOptions>
Remarks
Use the Presentation.inspect(PresentationInspectOptions) overload to specify which content types to inspect:
// Configure inspection options.
PresentationInspectOptions inspectOptions =
PresentationInspectOptions.fromValue(
PresentationInspectOptions._ALL_METADATA
| PresentationInspectOptions._MACROS
| PresentationInspectOptions._ACTIVE_X_CONTENT
| PresentationInspectOptions._OLE_OBJECTS
| PresentationInspectOptions._HIDDEN_SLIDES
| PresentationInspectOptions._HIDDEN_SHAPES
| PresentationInspectOptions._OFF_SLIDE_CONTENT);
// Inspect the presentation.
PresentationInspectResult inspectResult = presentation.inspect(inspectOptions);
The inspect() methods return a PresentationInspectResult object that contains information about potentially dangerous and private content detected in the presentation. You can use the inspection result to log content issues or prevent presentation distribution. For example, an application can mark a presentation that contains potentially unsafe content and prevent further distribution.
To remove detected content, call the PresentationInspectResult.createSanitizeOptions() method to create a PresentationSanitizeOptions object based on inspection results. Pass the resulting options to the Presentation.sanitize(PresentationSanitizeOptions) method.
The following code snippet inspects a presentation, creates sanitization options based on the inspection results, sanitizes the presentation, and saves the sanitized presentation to a file:
package presentation;
import com.devexpress.docs.presentation.*;
import java.io.*;
import java.nio.file.*;
import java.util.List;
public class Main {
public static void main(String[] args) throws Exception {
try (FileInputStream inputStream = new FileInputStream("Presentation.pptx");
Presentation presentation = new Presentation(inputStream)) {
PresentationInspectResult inspectResult = presentation.inspect();
// Log or process detected security and privacy issues.
// ...
// Create sanitization options based on inspection results.
PresentationSanitizeOptions sanitizeOptions = inspectResult.createSanitizeOptions();
// Remove detected content.
List<PresentationSanitizeResult> results = presentation.sanitize(sanitizeOptions);
// Log or process sanitization results.
// ...
Path outputDir = Path.of("output");
Files.createDirectories(outputDir);
// Save the sanitized presentation.
try (FileOutputStream fileStream = new FileOutputStream(
outputDir.resolve("Presentation_Sanitized.pptx").toFile())) {
presentation.saveDocument(fileStream);
}
}
}
}
Refer to the following help topic for additional information: Inspect a Presentation Before Sanitization.
Inherited Members
Inheritance
Fields
_ACTIVE_X_CONTENT Field
Specifies the integer value for inspecting ActiveX content.
Declaration
public static final int _ACTIVE_X_CONTENT
Field Value
| Type | Description |
|---|---|
| int | The integer value for inspecting ActiveX content. |
_ALL Field
Specifies the integer value for inspecting all supported content categories.
Declaration
public static final int _ALL
Field Value
| Type | Description |
|---|---|
| int | The integer value for inspecting all supported content categories. |
_ALL_METADATA Field
Specifies the integer value for inspecting all metadata categories.
Declaration
public static final int _ALL_METADATA
Field Value
| Type | Description |
|---|---|
| int | The integer value for inspecting all metadata categories. |
_AUTHOR_INFO Field
Specifies the integer value for inspecting author information.
Declaration
public static final int _AUTHOR_INFO
Field Value
| Type | Description |
|---|---|
| int | The integer value for inspecting author information. |
_COMMENTS Field
Specifies the integer value for inspecting comments.
Declaration
public static final int _COMMENTS
Field Value
| Type | Description |
|---|---|
| int | The integer value for inspecting comments. |
_CUSTOM_PROPERTIES Field
Specifies the integer value for inspecting custom document properties.
Declaration
public static final int _CUSTOM_PROPERTIES
Field Value
| Type | Description |
|---|---|
| int | The integer value for inspecting custom document properties. |
_CUSTOM_XML_PARTS Field
Specifies the integer value for inspecting custom XML parts.
Declaration
public static final int _CUSTOM_XML_PARTS
Field Value
| Type | Description |
|---|---|
| int | The integer value for inspecting custom XML parts. |
_DOCUMENT_DESCRIPTION Field
Specifies the integer value for inspecting document description metadata.
Declaration
public static final int _DOCUMENT_DESCRIPTION
Field Value
| Type | Description |
|---|---|
| int | The integer value for inspecting document description metadata. |
_DOCUMENT_HISTORY Field
Specifies the integer value for inspecting document history metadata.
Declaration
public static final int _DOCUMENT_HISTORY
Field Value
| Type | Description |
|---|---|
| int | The integer value for inspecting document history metadata. |
_EXTENDED_PROPERTIES Field
Specifies the integer value for inspecting extended document properties.
Declaration
public static final int _EXTENDED_PROPERTIES
Field Value
| Type | Description |
|---|---|
| int | The integer value for inspecting extended document properties. |
_HIDDEN_SHAPES Field
Specifies the integer value for inspecting hidden shapes.
Declaration
public static final int _HIDDEN_SHAPES
Field Value
| Type | Description |
|---|---|
| int | The integer value for inspecting hidden shapes. |
_HIDDEN_SLIDES Field
Specifies the integer value for inspecting hidden slides.
Declaration
public static final int _HIDDEN_SLIDES
Field Value
| Type | Description |
|---|---|
| int | The integer value for inspecting hidden slides. |
_MACROS Field
Specifies the integer value for inspecting macros.
Declaration
public static final int _MACROS
Field Value
| Type | Description |
|---|---|
| int | The integer value for inspecting macros. |
_NONE Field
Specifies the integer value for inspecting no content categories.
Declaration
public static final int _NONE
Field Value
| Type | Description |
|---|---|
| int | The integer value for inspecting no content categories. |
_NOTES Field
Specifies the integer value for inspecting speaker notes.
Declaration
public static final int _NOTES
Field Value
| Type | Description |
|---|---|
| int | The integer value for inspecting speaker notes. |
_OFF_SLIDE_CONTENT Field
Specifies the integer value for inspecting off-slide content.
Declaration
public static final int _OFF_SLIDE_CONTENT
Field Value
| Type | Description |
|---|---|
| int | The integer value for inspecting off-slide content. |
_OLE_OBJECTS Field
Specifies the integer value for inspecting OLE objects.
Declaration
public static final int _OLE_OBJECTS
Field Value
| Type | Description |
|---|---|
| int | The integer value for inspecting OLE objects. |
_ORGANIZATION_INFO Field
Specifies the integer value for inspecting organization information.
Declaration
public static final int _ORGANIZATION_INFO
Field Value
| Type | Description |
|---|---|
| int | The integer value for inspecting organization information. |
ACTIVE_X_CONTENT Field
Inspects ActiveX content.
Declaration
public static final PresentationInspectOptions ACTIVE_X_CONTENT
Field Value
| Type | Description |
|---|---|
PresentationInspectOptions |
A presentation inspect option that inspects ActiveX content. |
ALL Field
Inspects all supported content categories.
Declaration
public static final PresentationInspectOptions ALL
Field Value
| Type | Description |
|---|---|
PresentationInspectOptions |
A presentation inspect option that inspects all supported content categories. |
ALL_METADATA Field
Inspects all metadata categories.
Declaration
public static final PresentationInspectOptions ALL_METADATA
Field Value
| Type | Description |
|---|---|
PresentationInspectOptions |
A presentation inspect option that inspects all metadata categories. |
AUTHOR_INFO Field
Inspects author information.
Declaration
public static final PresentationInspectOptions AUTHOR_INFO
Field Value
| Type | Description |
|---|---|
PresentationInspectOptions |
A presentation inspect option that inspects author information. |
COMMENTS Field
Inspects comments.
Declaration
public static final PresentationInspectOptions COMMENTS
Field Value
| Type | Description |
|---|---|
PresentationInspectOptions |
A presentation inspect option that inspects comments. |
CUSTOM_PROPERTIES Field
Inspects custom document properties.
Declaration
public static final PresentationInspectOptions CUSTOM_PROPERTIES
Field Value
| Type | Description |
|---|---|
PresentationInspectOptions |
A presentation inspect option that inspects custom document properties. |
CUSTOM_XML_PARTS Field
Inspects custom XML parts.
Declaration
public static final PresentationInspectOptions CUSTOM_XML_PARTS
Field Value
| Type | Description |
|---|---|
PresentationInspectOptions |
A presentation inspect option that inspects custom XML parts. |
DOCUMENT_DESCRIPTION Field
Inspects document description metadata.
Declaration
public static final PresentationInspectOptions DOCUMENT_DESCRIPTION
Field Value
| Type | Description |
|---|---|
PresentationInspectOptions |
A presentation inspect option that inspects document description metadata. |
DOCUMENT_HISTORY Field
Inspects document history metadata.
Declaration
public static final PresentationInspectOptions DOCUMENT_HISTORY
Field Value
| Type | Description |
|---|---|
PresentationInspectOptions |
A presentation inspect option that inspects document history metadata. |
EXTENDED_PROPERTIES Field
Inspects extended document properties.
Declaration
public static final PresentationInspectOptions EXTENDED_PROPERTIES
Field Value
| Type | Description |
|---|---|
PresentationInspectOptions |
A presentation inspect option that inspects extended document properties. |
HIDDEN_SHAPES Field
Inspects hidden shapes.
Declaration
public static final PresentationInspectOptions HIDDEN_SHAPES
Field Value
| Type | Description |
|---|---|
PresentationInspectOptions |
A presentation inspect option that inspects hidden shapes. |
HIDDEN_SLIDES Field
Inspects hidden slides.
Declaration
public static final PresentationInspectOptions HIDDEN_SLIDES
Field Value
| Type | Description |
|---|---|
PresentationInspectOptions |
A presentation inspect option that inspects hidden slides. |
MACROS Field
Inspects macros.
Declaration
public static final PresentationInspectOptions MACROS
Field Value
| Type | Description |
|---|---|
PresentationInspectOptions |
A presentation inspect option that inspects macros. |
NONE Field
No content categories.
Declaration
public static final PresentationInspectOptions NONE
Field Value
| Type | Description |
|---|---|
PresentationInspectOptions |
A presentation inspect option that inspects no content categories. |
NOTES Field
Inspects speaker notes.
Declaration
public static final PresentationInspectOptions NOTES
Field Value
| Type | Description |
|---|---|
PresentationInspectOptions |
A presentation inspect option that inspects speaker notes. |
OFF_SLIDE_CONTENT Field
Inspects off-slide content.
Declaration
public static final PresentationInspectOptions OFF_SLIDE_CONTENT
Field Value
| Type | Description |
|---|---|
PresentationInspectOptions |
A presentation inspect option that inspects off-slide content. |
OLE_OBJECTS Field
Inspects OLE objects.
Declaration
public static final PresentationInspectOptions OLE_OBJECTS
Field Value
| Type | Description |
|---|---|
PresentationInspectOptions |
A presentation inspect option that inspects OLE objects. |
ORGANIZATION_INFO Field
Inspects organization information.
Declaration
public static final PresentationInspectOptions ORGANIZATION_INFO
Field Value
| Type | Description |
|---|---|
PresentationInspectOptions |
A presentation inspect option that inspects organization information. |
Methods
fromValue(int value) Method
Returns the enum item with the specified integer value.
Declaration
public static PresentationInspectOptions fromValue(int value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | int | The integer value. |
Returns
| Type | Description |
|---|---|
PresentationInspectOptions |
The enum item with the specified integer value. |
values() Method
Returns available constants.
Declaration
public static PresentationInspectOptions[] values()
Returns
| Type | Description |
|---|---|
| PresentationInspectOptions[] | The array that contains all |