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 & InitPython
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.
- This section has 8 entries; this is one of them.
- See the full section index: Pattern / Texture Fill
Other entries in this section
- shape.Fill.ApplyPatternFill(patternType, filePath)Tiles one of your own images. The path needs forward slashes or double
- shape.Fill.PatternThe pattern sub-object. Only reachable when Fill.Type == 9. For bitmap
- shape.Fill.ApplyTextureFill(TextureName, LibraryName)Applies a texture by name. The second argument is the style library; l
- shape.Fill.PostScript.Select("Bricks")PostScript textures. The old CorelDRAW set — bricks, grids, waves — li
- shape.Fill.ApplyNoFill()Removes the fill, making the shape transparent. Cleaner than filling w
- shape.Fill.CopyAssign(source_fill)Copies one shape's fill onto another — the fill half of the format pai
- shape.Fill.GetCopy() / fill.CompareWith(fill2)Takes a copy of a fill (leaving the original alone), or compares two f