xlwings: Shapes: Text Box

Use the AddTextbox method of the Shapes object to create a text box. The calling format and parameters are similar to the AddLabel method.

Code:

#Drawing Text Box

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.AddTextbox(1,10,10,100,50)
shp.TextFrame2.TextRange.Characters.Text='Test Box'

#bk.save()
#bk.close()
#app.kill()


category : xlwings: Shapes

Leave a Reply

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

Zoomed Image