WordProcessingContent
Leave feedback
On this page
Inheritance: java.lang.Object, com.groupdocs.watermark.contents.ContentPart, com.groupdocs.watermark.contents.Content
All Implemented Interfaces: com.groupdocs.watermark.internal.IEncryptable
public class WordProcessingContent extends Content implements IEncryptable
Class representing Word document (doc, docx etc) where watermark should be placed.
Learn more:
- Add watermarks to word processing documents
- Existing objects in word processing document
- Locking watermark in word processing document
- Protecting word processing documents
- Watermarks in word processing document
The following example demonstrates how to load and save Word document 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();
WordProcessingContent(StreamContainer stream, IStrategyManager strategyManager, FileFormatInfo fileFormatInfo, WordProcessingLoadOptions wordProcessingLoadOptions, WatermarkerSettings watermarkerSettings)
public WordProcessingContent(StreamContainer stream, IStrategyManager strategyManager, FileFormatInfo fileFormatInfo, WordProcessingLoadOptions wordProcessingLoadOptions, WatermarkerSettings watermarkerSettings)
Parameters:
| Parameter | Type | Description |
|---|---|---|
| stream | StreamContainer | |
| strategyManager | IStrategyManager | |
| fileFormatInfo | com.aspose.words.FileFormatInfo | |
| wordProcessingLoadOptions | WordProcessingLoadOptions | |
| watermarkerSettings | WatermarkerSettings |
public final WordProcessingSectionCollection getSections()
Gets the collection of all sections of this [WordProcessingContent](../../com.groupdocs.watermark.contents/wordprocessingcontent).
Returns:
WordProcessingSectionCollection - The collection of all sections of this [WordProcessingContent](../../com.groupdocs.watermark.contents/wordprocessingcontent).
public final void setSections(WordProcessingSectionCollection value)
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | WordProcessingSectionCollection |
public final int getPageCount()
Gets the number of pages in the document.
Returns: int - The number of pages in the document.
public final Document getAsposeWordsDocument()
Returns: com.aspose.words.Document
public final void encrypt(String password)
Encrypts the document.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| password | java.lang.String | 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)
Parameters:
| Parameter | Type | Description |
|---|---|---|
| watermark | Watermark | |
| pageNumber | int |
addWatermark(Watermark watermark, IWordProcessingWatermarkEffects effects, WordProcessingShapeSettings shapeSettings)
public final void addWatermark(Watermark watermark, IWordProcessingWatermarkEffects effects, WordProcessingShapeSettings shapeSettings)
Parameters:
| Parameter | Type | Description |
|---|---|---|
| watermark | Watermark | |
| effects | IWordProcessingWatermarkEffects | |
| shapeSettings | WordProcessingShapeSettings |
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](../../com.groupdocs.watermark.options/wordprocessinglocktype#AllowOnlyFormFields) or [WordProcessingLockType.ReadOnlyWithEditableContent](../../com.groupdocs.watermark.options/wordprocessinglocktype#ReadOnlyWithEditableContent) parameter.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| protectionType | int | The protection type for the document. |
| password | java.lang.String | The password to protect the document with. |
public final void unprotect()
Removes protection from the document regardless of the password.
public void performSave(String filePath)
Parameters:
| Parameter | Type | Description |
|---|---|---|
| filePath | java.lang.String |
public void performSave(String filePath, SaveOptions saveOptions)
Parameters:
| Parameter | Type | Description |
|---|---|---|
| filePath | java.lang.String | |
| saveOptions | SaveOptions |
public void performSave(OutputStream stream)
Parameters:
| Parameter | Type | Description |
|---|---|---|
| stream | java.io.OutputStream |
public void performSave(OutputStream stream, SaveOptions saveOptions)
Parameters:
| Parameter | Type | Description |
|---|---|---|
| stream | java.io.OutputStream | |
| saveOptions | SaveOptions |
public void add(Watermark watermark, WatermarkOptions options)
Parameters:
| Parameter | Type | Description |
|---|---|---|
| watermark | Watermark | |
| options | WatermarkOptions |
public void generatePreview(PreviewOptions previewOptions)
Parameters:
| Parameter | Type | Description |
|---|---|---|
| previewOptions | PreviewOptions |
public IDocumentInfo getDocumentInfo()
Returns: IDocumentInfo
public FileType getFileType()
Returns: FileType
public void addWatermark(Watermark watermark)
Parameters:
| Parameter | Type | Description |
|---|---|---|
| watermark | Watermark |
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.