TextureAlignment

TextureAlignment enumeration

Specifies the alignment for the tiling of the texture fill.

public enum TextureAlignment

Values

NameValueDescription
TopLeft0Top left texture alignment.
Top1Top texture alignment.
TopRight2Top right texture alignment.
Left3Left texture alignment.
Center4Center texture alignment.
Right5Right texture alignment.
BottomLeft6Bottom left texture alignment.
Bottom7Bottom texture alignment.
BottomRight8Bottom right texture alignment.
None9None texture alignment.

Examples

Shows how to fill and tiling the texture inside the shape.

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

Shape shape = builder.InsertShape(ShapeType.Rectangle, 80, 80);

// Apply texture alignment to the shape fill.
shape.Fill.PresetTextured(PresetTexture.Canvas);
shape.Fill.TextureAlignment = TextureAlignment.TopRight;

// Use the compliance option to define the shape using DML if you want to get "TextureAlignment"
// property after the document saves.
OoxmlSaveOptions saveOptions = new OoxmlSaveOptions { Compliance = OoxmlCompliance.Iso29500_2008_Strict };

doc.Save(ArtifactsDir + "Shape.TextureFill.docx", saveOptions);

doc = new Document(ArtifactsDir + "Shape.TextureFill.docx");
shape = (Shape)doc.GetChild(NodeType.Shape, 0, true);

Assert.AreEqual(TextureAlignment.TopRight, shape.Fill.TextureAlignment);
Assert.AreEqual(PresetTexture.Canvas, shape.Fill.PresetTexture);

See Also