How To Set Face Properties Using xlwings? – Transparency

Method

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

Sample Code

#Text Properties

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

sht.api.Range('C3').Value='Font Test123'
ft=sht.api.Range('C3').Font
ft.Name = 'Times New Roman'
ft.ColorIndex = 3
ft.Size = 20
ft.Bold=True
ft.Strikethrough = False
ft.Underline = 5
ft.Italic=True

#bk.save()
#bk.close()
#app.kill()
Set Face Properties Using xlwings? - Transparency

February 27, 2026 (0)


Leave a Reply

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