[Java] Java marks PPT document as final state

less than 1 minute read

After designing and creating a PPT document, you can mark the PPT document as final if you want to indicate that the document has reached its final design state and no one wants to edit or modify the internal content. This article describes how to use Free Spire.Presentation for Java to mark your PPT presentation as final version.

** Import JAR package **
Method 1: Download and unzip Free Spire.Presentation for Java and rely on the lib folder for the jar package Import directly into your Java application as a relationship.

Method 2: Install the jar package from the Maven repository and configure the code in the pom.xml file as follows:

<repositories>
        <repository>
            <id>com.e-iceblue</id>
            <name>e-iceblue</name>
            <url>http://repo.e-iceblue.com/nexus/content/groups/public/</url>
        </repository>
</repositories>
<dependencies>
    <dependency>
        <groupId>e-iceblue</groupId>
        <artifactId>spire.presentation.free</artifactId>
        <version>2.6.1</version>
    </dependency>
</dependencies>

** Java code **

import com.spire.presentation.FileFormat;
import com.spire.presentation.Presentation;

public class MarkAsFinal {
    public static void main(String[] args) throws Exception {

        //Load sample document
        Presentation presentation = new Presentation();
        presentation.loadFromFile("test.pptx");

        //Set the document property MarkAsFinal to true
        presentation.getDocumentProperty().set("_MarkAsFinal", true);

        //Save the document
        presentation.saveToFile("MarkasFinal.pptx", FileFormat.PPTX_2010);
    }
}

ja.png