Free Support Forum - aspose.com

Set Fill Texture Programatically

Hi Support,

I am trying to create a word document programmatically that can have fill texture effect of custom image. Can you please let me know how can I achieve it with .Net downloaded dll.

Please see attached sample doc that we want to achieve.

backcolor.png (472 Bytes)
backcustomtexture.zip (9.5 KB).

In MS Word we can do with following steps:
Create new Doc > Design > PageColor > Fill Effects > Texture > Other texture > Select Image(PNG) > OK

Thanks,
Pawan

@pawanbold,

Thanks for your inquiry. Please use DocumentBase.BackgroundShape property to achieve your requirement. This property gets or sets the background shape of the document. You need to create the Shape node of type image and set this property. Hope this helps you.

Thanks @tahir.manzoor Tahir for update. We tried this but it looks like it is not allowed to create a shape of image type for background. Please see the Remarks section of link below.

https://apireference.aspose.com/net/words/aspose.words/documentbase/properties/backgroundshape

Microsoft Word allows only a shape that has its ShapeType property equal to Rectangle to be used as a background shape for a document. Microsoft Word supports only the fill properties of a background shape. All other properties are ignored. Setting this property to a non-null value will also set the DisplayBackgroundShape to true.

Can you please help me with some of code to achieve this?

@pawanbold,

Thanks for your inquiry. You can set the image for Shape node using Shape.ImageData.SetImage method. However, this does not generate the correct output. We have logged this feature as WORDSNET-16880 in our issue tracking system. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan