Method
Use the `IncrementLeft` method of the `Shape` object to translate the graphic horizontally. This method has one parameter: when the value is greater than 0, the graphic moves to the right; when the value is less than 0, the graphic moves to the left.
Use the `IncrementTop` method of the `Shape` object to translate the graphic vertically. This method has one parameter: when the value is greater than 0, the graphic moves down; when the value is less than 0, the graphic moves up.
shp=sht.api.Shapes.AddShape(1, 100, 50, 200, 100) #Rectangular area
shp.Fill.PresetTextured(5) #Preset texture: Water drop
shp.IncrementLeft(70) #Move right by 70 units
shp.IncrementTop(50) #Move down by 50 units
Sample Code
#Rotation transformation
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, 100, 50, 200, 100) #Rectangular area
shp.Fill.PresetTextured(5) #Preset texture: Water drop
shp.IncrementRotation(30) #Rotate clockwise by 30°
#bk.save()
#bk.close()
#app.kill()

Leave a Reply