We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to set Shape fill and gradient effects using .NET

i want to insert a picture as a background in word how can i do?

and how to insert a shape and i can set it Fill Effectsv like gradient Texture and

other how can i do? thanks!

Hi Juao,

Thanks for your query. Unfortunately, Aspose.Words does not support the fill effects for shapes. We had already logged this feature request as WORDSNET-1697 in our issue tracking system. You will be notified via this forum thread once this feature is available.

Please use the following code snippet to add watermark. Hope this helps you. Please let us know if you have any more queries.

Document doc = new Document();

insertWatermarkImage(doc, @"d:\Chrysanthemum.jpg");

doc.Save(MyDir + "AsposeOut.docx");

private void insertWatermarkImage(Aspose.Words.Document doc, String watermarkImagePath)

{

Shape watermark = new Shape(doc, ShapeType.Image);

// Set up the the watermark.

watermark.ImageData.SetImage(watermarkImagePath);

watermark.Width = 500;

watermark.Height = 500;

// Place the watermark in the page center.

watermark.RelativeHorizontalPosition = RelativeHorizontalPosition.Page;

watermark.RelativeVerticalPosition = RelativeVerticalPosition.Page;

watermark.WrapType = WrapType.None;

watermark.VerticalAlignment = VerticalAlignment.Top;

watermark.HorizontalAlignment = Aspose.Words.Drawing.HorizontalAlignment.Left;

// Create a new paragraph and append the watermark to this paragraph.

Paragraph watermarkPara = new Paragraph(doc);

watermarkPara.AppendChild(watermark);

// Insert the watermark into all headers of each document section.

foreach (Aspose.Words.Section sect in doc.Sections)

{

insertWatermarkIntoHeader(watermarkPara, sect, (int)HeaderFooterType.HeaderPrimary);

insertWatermarkIntoHeader(watermarkPara, sect, (int)HeaderFooterType.HeaderFirst);

insertWatermarkIntoHeader(watermarkPara, sect, (int)HeaderFooterType.HeaderEven);

}

}

private void insertWatermarkIntoHeader(Paragraph watermarkPara, Aspose.Words.Section sect, int headerType)

{

HeaderFooter header = sect.HeadersFooters[HeaderFooterType.HeaderPrimary];

if (header == null)

{

// There is no header of the specified type in the current section, create it.

header = new HeaderFooter(sect.Document, HeaderFooterType.HeaderPrimary);

sect.HeadersFooters.Add(header);

}

// Insert a clone of the watermark into the header.

header.AppendChild(watermarkPara.Clone(true));

}

The issues you have found earlier (filed as WORDSNET-1697) have been fixed in this Aspose.Words for .NET 21.11 update also available on NuGet.