TRY NEW VERSION

Try now New API BETA

Try out the new view and capabilities of the API documentation

START

SetOpacity

SetOpacity(nOpacity)

Sets the opacity of the watermark in the document.

Parameters:

Name Type Description
nOpacity number

The watermark opacity. This value must be from 0 to 255.

Returns:

This method doesn't return any data.

Example

Copy code
builder.CreateFile("docx");
var oDocument = Api.GetDocument();
oDocument.InsertWatermark("Watermark", true);
var oSettings = oDocument.GetWatermarkSettings();
oSettings.SetOpacity(100);
oDocument.SetWatermarkSettings(oSettings);
var nOpacity = oSettings.GetOpacity();
var oParagraph = oDocument.GetElement(0);
oParagraph.AddText("Watermark opacity: "+ nOpacity);
builder.SaveFile("docx", "SetOpacity.docx");
builder.CloseFile();

Resulting document