GroupDocs Watermark for .NET We are pleased to announce the release of version 18.2 of GroupDocs.Watermark for .NET. The latest version allows you to edit the objects that can be considered as watermark in Word documents. Following are the features that are introduced in GroupDocs.Watermark for .NET 18.2.

Editing Watermark Objects in Word Documents

Replacing text for particular shapesWe have added the support of replacing text for particular shapes in a Word document. Following code sample shows how to use this feature.

using (WordsDocument doc = Document.Load(@"D:\input.docx"))
{
    foreach (WordsShape shape in doc.Sections[0].Shapes)
    {
        if (shape.Text.Contains("Some text"))
        {
            shape.Text = "Another text";
        }
    }
    doc.Save(@"D:\output.docx");
}

Replacing shape’s text with formattingUsing GroupDocs.Watermark for .NET 18.2, you can replace the text of the shapes with formatted text by specifying font family, font size, font style, font color etc.. Following code sample shows how to replace shape’s text with formatted text.

using (WordsDocument doc = Document.Load(@"D:\input.docx"))
{
    foreach (WordsShape shape in doc.Sections[0].Shapes)
    {
        if (shape.Text.Contains("Some text"))
        {
            shape.FormattedTextFragments.Clear();
            shape.FormattedTextFragments.Add("Another text", new Font("Calibri", 19, FontStyle.Bold), Color.Red, Color.Aqua);
        }
    }
    doc.Save(@"D:\output.docx");
}

Replacing shape’s imageIn version 18.2, we have also added the feature of replacing image of the shape in a Word document. Following code sample shows how to set the image of a shape.

using (WordsDocument doc = Document.Load(@"D:\input.doc"))
{
    foreach (WordsShape shape in doc.Sections[0].Shapes)
    {
        if (shape.Image != null)
        {
            shape.Image = new WordsWatermarkableImage(File.ReadAllBytes(@"D:\test.png"));
        }
    }
    doc.Save(@"D:\output.doc");
}

Modifying shape’s propertiesUsing version 18.2, you can also modify the properties of a shape in Word documents. The following code sample shows the properties that can be modified using GroupDocs.Watermark.

using (WordsDocument doc = Document.Load(@"D:\input.docx"))
{
    foreach (WordsShape shape in doc.Sections[0].Shapes)
    {
        if (shape.Text.Contains("Some text"))
        {
            shape.AlternativeText = "watermark";
            shape.RotateAngle = 30;
            shape.X = 200;
            shape.Y = 200;
            shape.Height = 100;
            shape.Width = 400;
            shape.BehindText = false;
        }
    }
    doc.Save(@"D:\output.docx");
}

Available Channels and Resources

Here are a few channels and resources for you to download, learn, try and get technical support on GroupDocs.Watermark:

Feedback

As always, we would love to hear your queries and suggestions at our forum.