patterned method

patterned(pattern_type)

Sets the specified fill to a pattern.

def patterned(self, pattern_type: aspose.words.drawing.PatternType):
    ...
ParameterTypeDescription
pattern_typePatternTypePatternType

patterned(pattern_type, fore_color, back_color)

Sets the specified fill to a pattern.

def patterned(self, pattern_type: aspose.words.drawing.PatternType, fore_color: aspose.pydrawing.Color, back_color: aspose.pydrawing.Color):
    ...
ParameterTypeDescription
pattern_typePatternTypePatternType
fore_coloraspose.pydrawing.ColorThe color of the foreground fill.
back_coloraspose.pydrawing.ColorThe color of the background fill.

Examples

Shows how to set pattern for a shape.

doc = aw.Document(MY_DIR + 'Shape stroke pattern border.docx')
shape = doc.get_child(aw.NodeType.SHAPE, 0, True).as_shape()
fill = shape.fill
print('Pattern value is:', fill.pattern)
# There are several ways specified fill to a pattern.
# 1 -  Apply pattern to the shape fill:
fill.patterned(aw.drawing.PatternType.DIAGONAL_BRICK)
# 2 -  Apply pattern with foreground and background colors to the shape fill:
fill.patterned(aw.drawing.PatternType.DIAGONAL_BRICK, aspose.pydrawing.Color.aqua, aspose.pydrawing.Color.bisque)
doc.save(ARTIFACTS_DIR + 'Shape.fill_pattern.docx')

See Also