How Java marks ppt presentations as final

Time:2020-9-30

preface

In the daily operation of PPT, when we finish editing and do not want to make any other changes to the document, we can mark the presentation as final. This article will introduce how to mark the final status of the presentation through Java program.

Use tool: Free Spire.Presentation for Java

Test environment:

  • Intellij Idea2019.1
  • JDK 1.8.0
  • Spire.Presentation.jar

Jar package acquisition and import:

Method 1Download free on the official website Spire.Presentation For Java product package, unzip the Spire.Presentation.jar Manually import into idea.

Method 2Import products and dependent packages are installed through Maven warehouse. Create a maven application in the pom.xml Configure Maven warehouse Path and specify in the file Spire.Presentation Maven dependency for Java.

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

After configuration, just click “import changes” to import jar package.

Code example

Free Spire.Presentation For Java providesgetDocumentProperty()Method to get the document properties, and set theMarkAsFinalSet the document property to true to mark the presentation as final.

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("C:UsersTest1DesktopSample.pptx");  
  
        //Set the document property markasfinal to true  
 presentation.getDocumentProperty().set("_MarkAsFinal", true);  
  
        //Save the document  
 presentation.saveToFile("output/MarkasFinal.pptx", FileFormat.PPTX_2010);  
    }  
}

design sketch:

How Java marks ppt presentations as final

Summary:

Free Spire.Presentation For Java realizes the function of marking PPT presentation as final state with only four lines of code, which is enough to show that its product performance and implementation effect are excellent. In addition, it can support many of the features of Microsoft office, and the running environment does not need to install Microsoft office.

Recommended Today

PHP 12th week function learning record

sha1() effect sha1()Function to evaluate the value of a stringSHA-1Hash. usage sha1(string,raw) case <?php $str = “Hello”; echo sha1($str); ?> result f7ff9e8b7bb2e09b70935a5d785e0cc5d9d0abf0 sha1_file() effect sha1_file()Function calculation fileSHA-1Hash. usage sha1_file(file,raw) case <?php $filename = “test.txt”; $sha1file = sha1_file($filename); echo $sha1file; ?> result aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d similar_text() effect similar_text()Function to calculate the similarity between two strings. usage similar_text(string1,string2,percent) case […]