Patterned

Patterned(PatternType)

Sets the specified fill to a pattern.

public void Patterned(PatternType patternType)
ParameterTypeDescription
patternTypePatternTypePatternType

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)
ParameterTypeDescription
patternTypePatternTypePatternType
foreColorColorThe color of the foreground fill.
backColorColorThe 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