Skip to main content

PresentationSanitizeResult Class

Contains information about an action performed on a presentation content type during sanitization.

Declaration

public final class PresentationSanitizeResult extends Struct<PresentationSanitizeResult>

Remarks

Call the Presentation.sanitize() method to remove potentially dangerous or private content with default sanitization options.

Use the Presentation.sanitize(PresentationSanitizeOptions options) overload to specify content types to be sanitized.

The sanitize() method returns a list of PresentationSanitizeResult objects. Each result describes a sanitization operation performed on the presentation.

The following code snippet applies a predefined sanitization policy:

package presentation;

import com.devexpress.docs.office.*;
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)) {

            PresentationSanitizeOptions sanitizeOptions = new PresentationSanitizeOptions();

            sanitizeOptions.setRemoveNotes(true);
            sanitizeOptions.setRemoveOffSlideContent(true);
            sanitizeOptions.setRemoveMacros(true);
            sanitizeOptions.setRemoveActiveXContent(true);
            sanitizeOptions.setRemoveOleObjects(true);
            sanitizeOptions.setMetadata(MetadataRemovalScope.ALL);
            sanitizeOptions.setHiddenSlides(HiddenContentSanitizeMode.REMOVE);
            sanitizeOptions.setHiddenShapes(HiddenContentSanitizeMode.IGNORE);

            List<PresentationSanitizeResult> results = presentation.sanitize(sanitizeOptions);

            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: Sanitize Presentation Content.

Inherited Members

com.devexpress.system.Struct.equals(java.lang.Object)
com.devexpress.system.Struct.getHashCode()
com.devexpress.system.Struct.hashCode()
java.lang.Object.clone()
java.lang.Object.finalize()
java.lang.Object.getClass()
java.lang.Object.notify()
java.lang.Object.notifyAll()
java.lang.Object.toString()
java.lang.Object.wait()
java.lang.Object.wait(long)
java.lang.Object.wait(long,int)

Inheritance

Object
com.devexpress.system.Struct
PresentationSanitizeResult

Constructors

PresentationSanitizeResult() Constructor

Initializes a new instance of the PresentationSanitizeResult class.

Declaration

public PresentationSanitizeResult()

PresentationSanitizeResult(PresentationContentType type, PresentationSanitizeAction action) Constructor

Initializes a new instance of the PresentationSanitizeResult class with the specified content type and sanitization action.

Declaration

public PresentationSanitizeResult(PresentationContentType type, PresentationSanitizeAction action)

Parameters

Name Type Description
type PresentationContentType

Presentation content type.

action PresentationSanitizeAction

Sanitization action.

Methods

equals(Object obj) Method

Returns whether the specified object is equal to the current object.

Declaration

public boolean equals(Object obj)

Parameters

Name Type Description
obj Object

The object to compare with the current PresentationSanitizeResult object.

Returns

Type Description
boolean

true if the specified object is equal to the current PresentationSanitizeResult object; otherwise, false.

getAction() Method

Returns the action performed on the presentation content.

Declaration

public PresentationSanitizeAction getAction()

Returns

Type Description
PresentationSanitizeAction

The action performed on the presentation content.

getType() Method

Returns the type of presentation content affected by the sanitization action.

Declaration

public PresentationContentType getType()

Returns

Type Description
PresentationContentType

Presentation content type.

hashCode() Method

Returns the hash code for the current PresentationSanitizeResult object.

Declaration

public int hashCode()

Returns

Type Description
int

The hash code.