Get the App
SLTechnology News&Howtos  ›  Development  › 

What is the method for Java to delete / copy watermarks in Word documents

Shulou Source: shulou.com Published: 2022-06-02 19:52:42 09月25日 Update

This article introduces the "Java delete / copy Word document watermark method is what" the relevant knowledge, in the actual case of the operation process, many people will encounter such a dilemma, then let Xiaobian lead you to learn how to deal with these situations! I hope you can read it carefully and be able to achieve something!

Jar package Import

Method 1: download the Free Spire.Doc for Java package and extract it, and then import the Spire.Doc.jar package under the lib folder into the Java application as a dependency.

Method 2: install the JAR package through the Maven warehouse and configure the pom.xml file as follows

Com.e-iceblue http://repo.e-iceblue.cn/repository/maven-public/ e-iceblue spire.doc.free 2.7.3

Original Word document:

Delete the text watermark:

Import com.spire.doc.Document;import com.spire.doc.FileFormat;public class RemoveWatermark {public static void main (String [] args) {/ / create Document instance Document doc = new Document (); / / load Word document doc.loadFromFile ("text watermark .docx") / / set watermark to empty doc.setWatermark (null); / / Save document doc.saveToFile ("RemoveWatermark.docx", FileFormat.Docx_2013);}}

Delete the text watermark effect:

Copy the image watermark:

Import com.spire.doc.*;public class CopyWatermark {public static void main (String [] args) {/ / load document 1 Document doc1 = new Document (); doc1.loadFromFile ("picture watermark .docx"); / / load document 2 Document doc2 = new Document (); doc2.loadFromFile ("target.docx") / / get the watermark effect of document 1, and set it to document 2 doc2.setWatermark (doc1.getWatermark ()); / / Save document 2 doc2.saveToFile ("CopyWatermark.docx", FileFormat.Docx_2013); doc2.dispose ();}}

Copy the image watermark effect:

This is the end of the content of "what is the method for Java to delete / copy the watermark of Word documents". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: Documents watermarks methods pictures effects text content renderings files more knowledge practicality learning and then warehouses code dilemmas examples practice applications Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux Redmi Xiaomi vpn Docker