public class WordProcessingContent extends Content implements IEncryptable
Learn more:
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();
| Constructor and Description |
|---|
WordProcessingContent(StreamContainer stream,
IStrategyManager strategyManager,
com.aspose.words.FileFormatInfo fileFormatInfo,
WordProcessingLoadOptions wordProcessingLoadOptions,
WatermarkerSettings watermarkerSettings) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(Watermark watermark,
WatermarkOptions options) |
void |
addWatermark(Watermark watermark) |
void |
addWatermark(Watermark watermark,
int pageNumber) |
void |
addWatermark(Watermark watermark,
IWordProcessingWatermarkEffects effects,
WordProcessingShapeSettings shapeSettings) |
void |
decrypt()
Decrypts the document.
|
void |
encrypt(String password)
Encrypts the document.
|
void |
generatePreview(PreviewOptions previewOptions) |
com.aspose.words.Document |
getAsposeWordsDocument() |
IDocumentInfo |
getDocumentInfo() |
FileType |
getFileType() |
int |
getPageCount()
Gets the number of pages in the document.
|
WordProcessingSectionCollection |
getSections()
Gets the collection of all sections of this
. |
void |
performSave(OutputStream stream) |
void |
performSave(OutputStream stream,
SaveOptions saveOptions) |
void |
performSave(String filePath) |
void |
performSave(String filePath,
SaveOptions saveOptions) |
void |
protect(int protectionType,
String password)
Protects the document from changes and sets a protection password.
|
void |
setSections(WordProcessingSectionCollection value) |
void |
unprotect()
Removes protection from the document regardless of the password.
|
close, dispose, dispose, getInfo, getInfo, getSearchableObjects, getStream, getWatermarkerSettings, registerDisposableResource, save, save, save, save, setSearchableObjectsafterWatermarkAdding, checkWatermarkingLicenseRestrictions, findImages, findImages, getParts, getSearchWatermarksInParts, getStrategyManager, getTopParent, search, search, setParts, tryGetWatermarkerSettingspublic WordProcessingContent(StreamContainer stream, IStrategyManager strategyManager, com.aspose.words.FileFormatInfo fileFormatInfo, WordProcessingLoadOptions wordProcessingLoadOptions, WatermarkerSettings watermarkerSettings)
public void add(Watermark watermark, WatermarkOptions options)
Contentpublic void addWatermark(Watermark watermark)
addWatermark in class ContentPartpublic final void addWatermark(Watermark watermark, int pageNumber)
public final void addWatermark(Watermark watermark, IWordProcessingWatermarkEffects effects, WordProcessingShapeSettings shapeSettings)
public final void decrypt()
Decrypts the document.
decrypt in interface IEncryptablepublic final void encrypt(String password)
Encrypts the document.
encrypt in interface IEncryptablepassword - The password that will be required to open the document.public void generatePreview(PreviewOptions previewOptions)
ContentgeneratePreview in class Contentpublic final com.aspose.words.Document getAsposeWordsDocument()
public IDocumentInfo getDocumentInfo()
ContentgetDocumentInfo in class Contentpublic FileType getFileType()
ContentgetFileType in class Contentpublic final int getPageCount()
Gets the number of pages in the document.
public final WordProcessingSectionCollection getSections()
WordProcessingContent.WordProcessingContent.public void performSave(OutputStream stream)
ContentperformSave in class Contentpublic void performSave(OutputStream stream, SaveOptions saveOptions)
ContentperformSave in class Contentpublic void performSave(String filePath)
ContentperformSave in class Contentpublic void performSave(String filePath, SaveOptions saveOptions)
ContentperformSave in class Contentpublic final void protect(int protectionType,
String password)
To have the content of the document editable use appropriate method of adding watermark with
or
WordProcessingLockType.AllowOnlyFormFields parameter.WordProcessingLockType.ReadOnlyWithEditableContent
protectionType - The protection type for the document.password - The password to protect the document with.public final void setSections(WordProcessingSectionCollection value)
public final void unprotect()
Removes protection from the document regardless of the password.
Copyright © 2026. All rights reserved.