How To Set Face Properties Using xlwings? – Preset Texture Fill

Method

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

ff1=shp1.Fill

ff1.PresetTextured(9)    #Preset texture: Green marble

Sample Code

#Area properties - Transparency

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

shp=sht.api.Shapes.AddShape(1, 200, 50, 200, 100)    #Rectangular area
shp2=sht.api.Shapes.AddShape(9, 150, 70, 200, 100)    #Elliptical area
ff=shp2.Fill
ff.ForeColor.RGB= xw.utils.rgb_to_int((255,0,0))    #Set elliptical area to red
ff.Transparency=0.7    #Transparency 0.7

#bk.save()
#bk.close()
#app.kill()
February 26, 2026 (0)


Leave a Reply

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