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(file_name=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: {0}'.format(fill.pattern))
# There are several ways specified fill to a pattern.
# 1 -  Apply pattern to the shape fill:
fill.patterned(pattern_type=aw.drawing.PatternType.DIAGONAL_BRICK)
# 2 -  Apply pattern with foreground and background colors to the shape fill:
fill.patterned(pattern_type=aw.drawing.PatternType.DIAGONAL_BRICK, fore_color=aspose.pydrawing.Color.aqua, back_color=aspose.pydrawing.Color.bisque)
doc.save(file_name=ARTIFACTS_DIR + 'Shape.FillPattern.docx')

See Also