patterned method

patterned(patternType)

Sets the specified fill to a pattern.

patterned(patternType: Aspose.Words.Drawing.PatternType)
ParameterTypeDescription
patternTypePatternTypePatternType

patterned(patternType, foreColor, backColor)

Sets the specified fill to a pattern.

patterned(patternType: Aspose.Words.Drawing.PatternType, foreColor: string, backColor: string)
ParameterTypeDescription
patternTypePatternTypePatternType
foreColorstringThe color of the foreground fill.
backColorstringThe color of the background fill.

Examples

Shows how to set pattern for a shape.

let doc = new aw.Document(base.myDir + "Shape stroke pattern border.docx");

let shape = doc.getShape(0, true);
let fill = shape.fill;

console.log(`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.DiagonalBrick);

// 2 -  Apply pattern with foreground and background colors to the shape fill:
fill.patterned(aw.Drawing.PatternType.DiagonalBrick, "#00FFFF", "#FFE4C4");

doc.save(base.artifactsDir + "Shape.FillPattern.docx");

See Also