SetText
SetText(string, string, string)
Adds a text watermark into the document.
public static void SetText(string inputFileName, string outputFileName, string watermarkText)
Parameter | Type | Description |
---|---|---|
inputFileName | String | The input file name. |
outputFileName | String | The output file name. |
watermarkText | String | Text that is displayed as a watermark. |
Remarks
If the output format is an image (BMP, EMF, EPS, GIF, JPEG, PNG, or WebP), each page of the output will be saved as a separate file. The specified output file name will be used to generate file names for each part following the rule: outputFile_partIndex.extension.
If the output format is TIFF, the output will be saved as a single multi-frame TIFF file.
Examples
Shows how to insert watermark text to the document.
string doc = MyDir + "Big document.docx";
string watermarkText = "This is a watermark";
Watermarker.SetText(doc, ArtifactsDir + "LowCode.WatermarkText.1.docx", watermarkText);
Watermarker.SetText(doc, ArtifactsDir + "LowCode.WatermarkText.2.docx", SaveFormat.Docx, watermarkText);
TextWatermarkOptions watermarkOptions = new TextWatermarkOptions();
watermarkOptions.Color = Color.Red;
Watermarker.SetText(doc, ArtifactsDir + "LowCode.WatermarkText.3.docx", watermarkText, watermarkOptions);
Watermarker.SetText(doc, ArtifactsDir + "LowCode.WatermarkText.4.docx", SaveFormat.Docx, watermarkText, watermarkOptions);
See Also
- class Watermarker
- namespace Aspose.Words.LowCode
- assembly Aspose.Words
SetText(string, string, string, TextWatermarkOptions)
Adds a text watermark into the document with options.
public static void SetText(string inputFileName, string outputFileName, string watermarkText,
TextWatermarkOptions options)
Parameter | Type | Description |
---|---|---|
inputFileName | String | The input file name. |
outputFileName | String | The output file name. |
watermarkText | String | Text that is displayed as a watermark. |
options | TextWatermarkOptions | Defines additional options for the text watermark. |
Remarks
If the output format is an image (BMP, EMF, EPS, GIF, JPEG, PNG, or WebP), each page of the output will be saved as a separate file. The specified output file name will be used to generate file names for each part following the rule: outputFile_partIndex.extension.
If the output format is TIFF, the output will be saved as a single multi-frame TIFF file.
Examples
Shows how to insert watermark text to the document.
string doc = MyDir + "Big document.docx";
string watermarkText = "This is a watermark";
Watermarker.SetText(doc, ArtifactsDir + "LowCode.WatermarkText.1.docx", watermarkText);
Watermarker.SetText(doc, ArtifactsDir + "LowCode.WatermarkText.2.docx", SaveFormat.Docx, watermarkText);
TextWatermarkOptions watermarkOptions = new TextWatermarkOptions();
watermarkOptions.Color = Color.Red;
Watermarker.SetText(doc, ArtifactsDir + "LowCode.WatermarkText.3.docx", watermarkText, watermarkOptions);
Watermarker.SetText(doc, ArtifactsDir + "LowCode.WatermarkText.4.docx", SaveFormat.Docx, watermarkText, watermarkOptions);
See Also
- class TextWatermarkOptions
- class Watermarker
- namespace Aspose.Words.LowCode
- assembly Aspose.Words
SetText(string, string, SaveFormat, string, TextWatermarkOptions)
Adds a text watermark into the document with options and specified save format.
public static void SetText(string inputFileName, string outputFileName, SaveFormat saveFormat,
string watermarkText, TextWatermarkOptions options = null)
Parameter | Type | Description |
---|---|---|
inputFileName | String | The input file name. |
outputFileName | String | The output file name. |
saveFormat | SaveFormat | The save format. |
watermarkText | String | Text that is displayed as a watermark. |
options | TextWatermarkOptions | Defines additional options for the text watermark. |
Remarks
If the output format is an image (BMP, EMF, EPS, GIF, JPEG, PNG, or WebP), each page of the output will be saved as a separate file. The specified output file name will be used to generate file names for each part following the rule: outputFile_partIndex.extension.
If the output format is TIFF, the output will be saved as a single multi-frame TIFF file.
Examples
Shows how to insert watermark text to the document.
string doc = MyDir + "Big document.docx";
string watermarkText = "This is a watermark";
Watermarker.SetText(doc, ArtifactsDir + "LowCode.WatermarkText.1.docx", watermarkText);
Watermarker.SetText(doc, ArtifactsDir + "LowCode.WatermarkText.2.docx", SaveFormat.Docx, watermarkText);
TextWatermarkOptions watermarkOptions = new TextWatermarkOptions();
watermarkOptions.Color = Color.Red;
Watermarker.SetText(doc, ArtifactsDir + "LowCode.WatermarkText.3.docx", watermarkText, watermarkOptions);
Watermarker.SetText(doc, ArtifactsDir + "LowCode.WatermarkText.4.docx", SaveFormat.Docx, watermarkText, watermarkOptions);
See Also
- enum SaveFormat
- class TextWatermarkOptions
- class Watermarker
- namespace Aspose.Words.LowCode
- assembly Aspose.Words
SetText(string, string, SaveOptions, string, TextWatermarkOptions)
Adds a text watermark into the document with options and specified save format.
public static void SetText(string inputFileName, string outputFileName, SaveOptions saveOptions,
string watermarkText, TextWatermarkOptions options = null)
Parameter | Type | Description |
---|---|---|
inputFileName | String | The input file name. |
outputFileName | String | The output file name. |
saveOptions | SaveOptions | The save options. |
watermarkText | String | Text that is displayed as a watermark. |
options | TextWatermarkOptions | Defines additional options for the text watermark. |
Remarks
If the output format is an image (BMP, EMF, EPS, GIF, JPEG, PNG, or WebP), each page of the output will be saved as a separate file. The specified output file name will be used to generate file names for each part following the rule: outputFile_partIndex.extension.
If the output format is TIFF, the output will be saved as a single multi-frame TIFF file.
See Also
- class SaveOptions
- class TextWatermarkOptions
- class Watermarker
- namespace Aspose.Words.LowCode
- assembly Aspose.Words
SetText(Stream, Stream, SaveFormat, string, TextWatermarkOptions)
Adds a text watermark into the document from streams with options.
public static void SetText(Stream inputStream, Stream outputStream, SaveFormat saveFormat,
string watermarkText, TextWatermarkOptions options = null)
Parameter | Type | Description |
---|---|---|
inputStream | Stream | The input stream. |
outputStream | Stream | The output stream. |
saveFormat | SaveFormat | The save format. |
watermarkText | String | Text that is displayed as a watermark. |
options | TextWatermarkOptions | Defines additional options for the text watermark. |
Remarks
If the output format is an image (BMP, EMF, EPS, GIF, JPEG, PNG, or WebP), only the first page of the output will be saved to the specified stream.
If the output format is TIFF, the output will be saved as a single multi-frame TIFF to the specified stream.
Examples
Shows how to insert watermark text to the document from the stream.
string watermarkText = "This is a watermark";
using (FileStream streamIn = new FileStream(MyDir + "Document.docx", FileMode.Open, FileAccess.Read))
{
using (FileStream streamOut = new FileStream(ArtifactsDir + "LowCode.WatermarkTextStream.1.docx", FileMode.Create, FileAccess.ReadWrite))
Watermarker.SetText(streamIn, streamOut, SaveFormat.Docx, watermarkText);
using (FileStream streamOut = new FileStream(ArtifactsDir + "LowCode.WatermarkTextStream.2.docx", FileMode.Create, FileAccess.ReadWrite))
{
TextWatermarkOptions options = new TextWatermarkOptions();
options.Color = Color.Red;
Watermarker.SetText(streamIn, streamOut, SaveFormat.Docx, watermarkText, options);
}
}
See Also
- enum SaveFormat
- class TextWatermarkOptions
- class Watermarker
- namespace Aspose.Words.LowCode
- assembly Aspose.Words
SetText(Stream, Stream, SaveOptions, string, TextWatermarkOptions)
Adds a text watermark into the document from streams with options.
public static void SetText(Stream inputStream, Stream outputStream, SaveOptions saveOptions,
string watermarkText, TextWatermarkOptions options = null)
Parameter | Type | Description |
---|---|---|
inputStream | Stream | The input stream. |
outputStream | Stream | The output stream. |
saveOptions | SaveOptions | The save options. |
watermarkText | String | Text that is displayed as a watermark. |
options | TextWatermarkOptions | Defines additional options for the text watermark. |
Remarks
If the output format is an image (BMP, EMF, EPS, GIF, JPEG, PNG, or WebP), only the first page of the output will be saved to the specified stream.
If the output format is TIFF, the output will be saved as a single multi-frame TIFF to the specified stream.
See Also
- class SaveOptions
- class TextWatermarkOptions
- class Watermarker
- namespace Aspose.Words.LowCode
- assembly Aspose.Words