Home/ Reference/ Pattern / Texture Fill

shape.Fill.ApplyPatternFill(Type, FileName, CanvasIndex, FrontColor, BackColor, TransformWithShape)

Applies a pattern fill. Type: 0 two-color / 1 full-color vector / 2 bitmap. Two-color patterns use the built-in canvases; to tile your own image, pass 2 with the fil

Signature

shape.Fill.ApplyPatternFill(Type, FileName, CanvasIndex, FrontColor, BackColor, TransformWithShape)

Notes

Applies a pattern fill. Type: 0 two-color / 1 full-color vector / 2 bitmap. Two-color patterns use the built-in canvases; to tile your own image, pass 2 with the file path.

Python example (runnable)

Requires pywin32. The example assumes app / doc / page / layer are already connected. See Connection & Init
Python
shape = app.ActiveSelectionRange(1)

# two-colour pattern: use the built-in canvas, set the two colours
pf = shape.Fill.ApplyPatternFill(0)                 # 0 = two-colour pattern
pf.FrontColor.RGBAssign(0, 133, 205)                # foreground colour (the darker part)
pf.BackColor.RGBAssign(255, 255, 255)               # background colour

print("Pattern type: ", pf.Type)                          # 0/1/2
print("Fill type: ", shape.Fill.Type)                  # 9 = pattern fill

About this section: Pattern / Texture Fill

Pattern / Texture Fill — pattern, texture and PostScript fills.

Other entries in this section