Patterned

Patterned(PatternType)

Sets the specified fill to a pattern.

public void Patterned(PatternType patternType)
Parameter Type Description
patternType PatternType PatternType

Examples

Shows how to set pattern for a shape.

Document doc = new Document(MyDir + "Shape stroke pattern border.docx");

Shape shape = (Shape)doc.GetChild(NodeType.Shape, 0, true);
Fill fill = shape.Fill;

Console.WriteLine("Pattern value is: {0}", fill.Pattern);

// There are several ways specified fill to a pattern.
// 1 -  Apply pattern to the shape fill:
fill.Patterned(PatternType.DiagonalBrick);

// 2 -  Apply pattern with foreground and background colors to the shape fill:
fill.Patterned(PatternType.DiagonalBrick, Color.Aqua, Color.Bisque);

doc.Save(ArtifactsDir + "Shape.FillPattern.docx");

See Also


Patterned(PatternType, Color, Color)

Sets the specified fill to a pattern.

public void Patterned(PatternType patternType, Color foreColor, Color backColor)
Parameter Type Description
patternType PatternType PatternType
foreColor Color The color of the foreground fill.
backColor Color The color of the background fill.

Examples

Shows how to set pattern for a shape.

Document doc = new Document(MyDir + "Shape stroke pattern border.docx");

Shape shape = (Shape)doc.GetChild(NodeType.Shape, 0, true);
Fill fill = shape.Fill;

Console.WriteLine("Pattern value is: {0}", fill.Pattern);

// There are several ways specified fill to a pattern.
// 1 -  Apply pattern to the shape fill:
fill.Patterned(PatternType.DiagonalBrick);

// 2 -  Apply pattern with foreground and background colors to the shape fill:
fill.Patterned(PatternType.DiagonalBrick, Color.Aqua, Color.Bisque);

doc.Save(ArtifactsDir + "Shape.FillPattern.docx");

See Also