public class WordProcessingContent extends Content
Class representing Word document (doc, docx etc) where watermark should be placed.
This example demonstrates how to load and save Word content of any supported type.
WordProcessingLoadOptions loadOptions = new WordProcessingLoadOptions(); Watermarker watermarker = new Watermarker(@"D:\input.doc", loadOptions); // Use add method to add watermark to a particular or all sections. // Save changes. watermarker.save("D:\\output.doc"); watermarker.close();
Modifier and Type | Method and Description |
---|---|
void |
decrypt()
Decrypts the document.
|
void |
encrypt(String password)
Encrypts the document.
|
int |
getPageCount()
Gets the number of pages in the document.
|
WordProcessingSectionCollection |
getSections()
Gets the collection of all sections of this
WordProcessingContent . |
void |
performSave(OutputStream stream)
Saves the document data to the specified stream.
|
void |
performSave(OutputStream stream,
SaveOptions saveOptions)
Saves the document data to the specified stream.
|
void |
protect(int protectionType,
String password)
Protects the document from changes and sets a protection password.
|
void |
setSections(WordProcessingSectionCollection value)
Gets the collection of all sections of this
WordProcessingContent . |
void |
unprotect()
Removes protection from the document regardless of the password.
|
findImages, findImages, search, search
public final WordProcessingSectionCollection getSections()
Gets the collection of all sections of this WordProcessingContent
.
WordProcessingContent
.public final void setSections(WordProcessingSectionCollection value)
Gets the collection of all sections of this WordProcessingContent
.
public final int getPageCount()
Gets the number of pages in the document.
public final void encrypt(String password)
Encrypts the document.
password
- The password that will be required to open the document.public final void decrypt()
Decrypts the document.
public final void protect(int protectionType, String password)
Protects the document from changes and sets a protection password.
To have the content of the document editable use appropriate method of adding watermark with
WordProcessingLockType.AllowOnlyFormFields
or
WordProcessingLockType.ReadOnlyWithEditableContent
parameter.
protectionType
- Specifies the protection type for the document.password
- The password to protect the document with.public final void unprotect()
Removes protection from the document regardless of the password.
public void performSave(OutputStream stream)
Saves the document data to the specified stream.
performSave
in class Content
stream
- The stream to save the document data to.public void performSave(OutputStream stream, SaveOptions saveOptions)
Saves the document data to the specified stream.
performSave
in class Content
stream
- The stream to save the document data to.saveOptions
- The options tha should be used when saving the content data.Copyright © 2020. All rights reserved.