@Deprecated public class WordsDocument extends Document
Class representing Word document (doc, docx etc) where watermark should be placed.
This example demonstrates how to load and save Word document of any supported type.
WordsDocument document = Document.load(WordsDocument.class, "D:\\input.doc"); // Use addWatermark method to add watermark to all sections. // Use the collection of sections to add watermark to a particular section. // Save changes. document.save("D:\\output.doc"); document.close();
Modifier and Type | Method and Description |
---|---|
void |
addImageWatermark(ImageWatermark watermark,
WordsImageEffects effects)
Deprecated.
Adds an image watermark to all sections of this
WordsDocument . |
void |
addImageWatermark(ImageWatermark watermark,
WordsImageEffects effects,
WordsShapeSettings shapeSettings)
Deprecated.
Adds an image watermark to all sections of this
WordsDocument . |
void |
addTextWatermark(TextWatermark watermark,
WordsTextEffects effects)
Deprecated.
Adds a text watermark to all sections of this
WordsDocument . |
void |
addTextWatermark(TextWatermark watermark,
WordsTextEffects effects,
WordsShapeSettings shapeSettings)
Deprecated.
Adds a text watermark to all sections of this
WordsDocument . |
void |
addWatermark(Watermark watermark)
Deprecated.
Adds a watermark to all sections of this
WordsDocument . |
void |
addWatermark(Watermark watermark,
int pageNumber)
Deprecated.
Adds a watermark to a particular pages of this
WordsDocument . |
void |
addWatermark(Watermark watermark,
WordsShapeSettings shapeSettings)
Deprecated.
Adds a watermark to all sections of this
WordsDocument . |
void |
decrypt()
Deprecated.
Decrypts the document.
|
void |
encrypt(String password)
Deprecated.
Encrypts the document.
|
int |
getPageCount()
Deprecated.
Gets the number of pages in the document.
|
WordsSectionCollection |
getSections()
Deprecated.
Gets the collection of all sections of this
WordsDocument . |
void |
protect(int protectionType,
String password)
Deprecated.
Protects the document from changes and sets a protection password.
|
void |
unprotect()
Deprecated.
Removes protection from the document regardless of the password.
|
close, dispose, dispose, getDefaultSearchableObjects, getInfo, getInfo, getSearchableObjects, load, load, load, load, load, load, load, load, save, save, setDefaultSearchableObjects, setSearchableObjects
findImages, findImages, findWatermarks, findWatermarks
public final WordsSectionCollection getSections()
Gets the collection of all sections of this WordsDocument
.
WordsDocument
.
This example demonstrates how to add watermark to a particular section.
WordsDocument document = Document.load(WordsDocument.class, "D:\\input.doc"); // Initialize text or image watermark. TextWatermark watermark = new TextWatermark("DRAFT", new Font("Arial", 19)); // Add watermark to a particular section. document.getSections().get_Item(0).addWatermark(watermark); // Save changes. document.save("D:\\output.doc"); document.close();
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 addWatermark(Watermark watermark, int pageNumber)
Adds a watermark to a particular pages of this WordsDocument
.
Do not use this method to add watermarks to all pages in loop.
This may lead to significant decrease of performance. Use AddWatermark(Watermark)
instead.
watermark
- The watermark to add to the document.pageNumber
- The page number. Correct values are in range from 1 to PageCount
.public void addWatermark(Watermark watermark)
Adds a watermark to all sections of this WordsDocument
.
This method assumes that watermark offset and size are measured in points (if they are assigned).
addWatermark
in class DocumentPart
watermark
- The watermark to add to the document.public final void addWatermark(Watermark watermark, WordsShapeSettings shapeSettings)
Adds a watermark to all sections of this WordsDocument
.
This method assumes that watermark offset and size are measured in points (if they are assigned).
watermark
- The watermark to add to the document.shapeSettings
- Settings that should be applied to the watermark.public final void addTextWatermark(TextWatermark watermark, WordsTextEffects effects)
Adds a text watermark to all sections of this WordsDocument
.
This method assumes that watermark offset and size are measured in points (if they are assigned).
watermark
- The text watermark to add to the document.effects
- Text effects that should be applied to the watermark.public final void addTextWatermark(TextWatermark watermark, WordsTextEffects effects, WordsShapeSettings shapeSettings)
Adds a text watermark to all sections of this WordsDocument
.
This method assumes that watermark offset and size are measured in points (if they are assigned).
watermark
- The text watermark to add to the document.effects
- Text effects that should be applied to the watermark.shapeSettings
- Shape settings that should be applied to the watermark.public final void addImageWatermark(ImageWatermark watermark, WordsImageEffects effects)
Adds an image watermark to all sections of this WordsDocument
.
This method assumes that watermark offset and size are measured in points (if they are assigned).
watermark
- The image watermark to add to the document.effects
- Image effects that should be applied to the watermark.public final void addImageWatermark(ImageWatermark watermark, WordsImageEffects effects, WordsShapeSettings shapeSettings)
Adds an image watermark to all sections of this WordsDocument
.
This method assumes that watermark offset and size are measured in points (if they are assigned).
watermark
- The image watermark to add to the document.effects
- Image effects that should be applied to the watermark.shapeSettings
- Shape settings that should be applied to the watermark.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
WordsLockType.AllowOnlyFormFields
or WordsLockType.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.