Add a text watermark to Word, the watermark has a stroke

I add a text watermark to Word, and set IsSemitrasparent = true, but the displayed result is that the text stroke is not translucent.

Version info

Aspose.Words for Net 23.2

Sample Code

Document doc = new Document(@"C:\Users\54390\Desktop\demo.docx");
var watermarkOptions = new TextWatermarkOptions();
watermarkOptions.Color = System.Drawing.Color.Red;
watermarkOptions.IsSemitrasparent = true;
watermarkOptions.Layout = WatermarkLayout.Diagonal;
	
doc.Watermark.SetText("My WaterMark", watermarkOptions);
doc.Save(@"C:\Users\54390\Desktop\output.docx");

The Result

@sullivan Watermark in MS Word document is a simple WordArt shape and there is no way to specify stroke line transparency in this kind of shape:

You can simply disable stroke of watermark shapes in your document to get the desired output:

Document doc = new Document();
var watermarkOptions = new TextWatermarkOptions();
watermarkOptions.Color = System.Drawing.Color.Red;
watermarkOptions.IsSemitrasparent = true;
watermarkOptions.Layout = WatermarkLayout.Diagonal;
doc.Watermark.SetText("My WaterMark", watermarkOptions);

// Get all watermark shapes and reset border line.
doc.GetChildNodes(NodeType.Shape, true).Cast<Shape>().Where(s => s.Name.StartsWith("PowerPlusWaterMarkObject"))
    .ToList().ForEach(s => { s.Stroked = false; });
            
doc.Save(@"C:\Temp\output.docx");

I see, Thank you!

1 Like