PresentationInspectResult Class
Contains information about content types detected in a presentation during inspection.
Declaration
public class PresentationInspectResult extends JavaObject
Remarks
Refer to the following help topic for additional information: Inspect a Presentation Before Sanitization.
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);
}
}
}
}
Inherited Members
Inheritance
Methods
createSanitizeOptions() Method
Returns PresentationSanitizeOptions based on content types detected in the presentation.
Declaration
public PresentationSanitizeOptions createSanitizeOptions()
Returns
| Type | Description |
|---|---|
| PresentationSanitizeOptions | Sanitize options. |
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.
getContentTypes() Method
Returns a list of content types detected in the presentation.
Declaration
public List<PresentationContentType> getContentTypes()
Returns
| Type | Description |
|---|---|
| java.util.List<PresentationContentType> | Content types detected in the presentation. |