How To Set Face Properties Using xlwings? – Texture Fill

Method

Using UserTextured method.

 

shp1=sht.api.Shapes.AddShape(1, 100, 50, 200, 100)    #Rectangular area

ff1=shp1.Fill

ff1.UserTextured(root+r”/picpy.jpg”)    #Texture fill

Sample Code

#Area properties - Preset texture fill.

import xlwings as xw    #Import xlwings package

app=xw.App()
bk=app.books.active   #Get the active workbook
sht=bk.sheets.active    #Get the active worksheet

shp1=sht.api.Shapes.AddShape(1, 100, 50, 200, 100)    #Rectangular area
ff1=shp1.Fill
ff1.PresetTextured(9)    #Preset texture: Green marble

shp2=sht.api.Shapes.AddShape(9, 400, 50, 200, 100)    #Elliptical area
ff2=shp2.Fill
ff2.PresetTextured(22)    #Preset texture: Walnut wood

#bk.save()
#bk.close()
#app.kill()
Set Face Properties Using xlwings? - Texture Fill
February 26, 2026 (0)


Leave a Reply

Your email address will not be published. Required fields are marked *