Border around WordArt/TextBox text using Shape/watermark in Aspose.words

Is there a way to get rid of the border around the font when creating a watermark on a document? The attached picture is a blown up version of the doc file we are using. Code is below that I’m using. I’d like to have the text be all the same color. The only way I can do that is to set the font to black, but that’s too dark. If I set the font to black and turn down the opacity, the border of the text is darker than the fill.

The code is mostly copied from the forum in an attempt to get the feature to work.

Thanks.

WORD.Drawing.Shape watermark = new Aspose.Words.Drawing.Shape(doc, Aspose.Words.Drawing.ShapeType.TextPlainText);
watermark.TextPath.Text = _assay.SampleInfo.Batch;
watermark.TextPath.Size = _reportSettings.WatermarkFontSize;
watermark.TextPath.FontFamily = "Times New Roman";
// watermark.TextPath.FitPath = false;
watermark.TextPath.FitShape = false;
watermark.TextPath.Bold = true;
watermark.Width = 600;
watermark.Height = 300;
watermark.BehindText = true;
watermark.TextPath.Kerning = true;
watermark.TextPath.Shadow = true;
// watermark.Fill.Color = System.Drawing.Color.Green;
watermark.Fill.On = true;
watermark.Fill.Color = System.Drawing.Color.Black;
watermark.Fill.Opacity = 0.5;

watermark.Left = _reportSettings.WatermarkX;
watermark.Top = _reportSettings.WatermarkY;
// watermark.RelativeHorizontalPosition = WORD.Drawing.RelativeHorizontalPosition.Page;
// watermark.RelativeVerticalPosition = WORD.Drawing.RelativeVerticalPosition.Page;
watermark.WrapType = WORD.Drawing.WrapType.None;
watermark.VerticalAlignment = Aspose.Words.Drawing.VerticalAlignment.Center;
watermark.HorizontalAlignment = WORD.Drawing.HorizontalAlignment.Center;

WORD.Paragraph watermarkPar = new WORD.Paragraph(doc);
watermarkPar.AppendChild(watermark);

ArrayList hfTypes = new ArrayList();

hfTypes.Add(WORD.HeaderFooterType.HeaderPrimary);
//Now we should insert watermark into the header of each section of document
foreach (WORD.Section sect in doc.Sections)
{
    foreach (WORD.HeaderFooterType hftype in hfTypes)
    {
        if (sect.HeadersFooters[hftype] == null)
        {
            //Create new header
            if (hftype == WORD.HeaderFooterType.HeaderPrimary ||
            hftype == WORD.HeaderFooterType.HeaderFirst && sect.PageSetup.DifferentFirstPageHeaderFooter ||
            hftype == WORD.HeaderFooterType.HeaderEven && sect.PageSetup.OddAndEvenPagesHeaderFooter)
            {
                WORD.HeaderFooter hf = new WORD.HeaderFooter(doc, hftype);
                //insert clone of watermarkPar into the header
                hf.AppendChild(watermarkPar.Clone(true));
                sect.HeadersFooters.Add(hf);
            }
        }
        else
        {
            sect.HeadersFooters[hftype].AppendChild(watermarkPar.Clone(true));
        }
    }
}

Hi

Thanks for your inquiry. Please try using the following code to insert watermark into the document.

/// 
/// Inserts watermark into the document
/// 
/// Input document
/// Text of waermark
public void InsertWatermarkText(Document doc, string watermarkText)
{
    //Create whatermark shape
    //This will be WordArt shape. You are free to use any type of shape as watermark
    Shape watermark = new Shape(doc, ShapeType.TextPlainText);
    //This will be text of watermark
    watermark.TextPath.Text = watermarkText;
    watermark.TextPath.FontFamily = "Times New Roman";
    watermark.Width = 600;
    watermark.Height = 100;
    //Text dirrection will be from bottom-left corner to top-right
    watermark.Rotation = -45;
    //Uncomment the following line if you need solid black text
    watermark.Fill.Color = Color.Gray;
    watermark.StrokeColor = Color.Gray;
    //Set position of watermark
    //Watermark should be placed on the center of page
    watermark.RelativeHorizontalPosition = RelativeHorizontalPosition.Page;
    watermark.RelativeVerticalPosition = RelativeVerticalPosition.Page;
    watermark.WrapType = WrapType.None;
    watermark.VerticalAlignment = VerticalAlignment.Center;
    watermark.HorizontalAlignment = HorizontalAlignment.Center;
    //Create new paragraph and append watermark to this paragraph
    Paragraph watermarkPar = new Paragraph(doc);
    watermarkPar.AppendChild(watermark);
    ArrayList hfTypes = new ArrayList();
    hfTypes.Add(HeaderFooterType.HeaderPrimary);
    hfTypes.Add(HeaderFooterType.HeaderFirst);
    hfTypes.Add(HeaderFooterType.HeaderEven);
    //Now we should insert watermark into the header of each section of document
    foreach (Section sect in doc.Sections)
    {
        foreach (HeaderFooterType hftype in hfTypes)
        {
            if (sect.HeadersFooters[hftype] == null)
            {
                //If there is no header of the specified type in the current section we should create new header
                if (hftype == HeaderFooterType.HeaderPrimary ||
                hftype == HeaderFooterType.HeaderFirst && sect.PageSetup.DifferentFirstPageHeaderFooter ||
                hftype == HeaderFooterType.HeaderEven && sect.PageSetup.OddAndEvenPagesHeaderFooter)
                {
                    HeaderFooter hf = new HeaderFooter(doc, hftype);
                    //Insert clone of watermarkPar into the header
                    hf.AppendChild(watermarkPar.Clone(true));
                    sect.HeadersFooters.Add(hf);
                }
            }
            else
            {
                //If the header of specified type exists then just insert watermark
                sect.HeadersFooters[hftype].AppendChild(watermarkPar.Clone(true));
            }
        }
    }
}

Hope this helps.

Best regards.

Works great. Thanks.