Class ShapeTextAlignment

ShapeTextAlignment class

Represents the setting of shape’s text alignment;

public class ShapeTextAlignment

Properties

NameDescription
AutoSize { get; set; }Indicates if size of shape is adjusted automatically according to its content.
BottomMarginPt { get; set; }Returns the bottom margin in unit of Points
IsAutoMargin { get; set; }Indicates whether the margin of the text frame is automatic.
IsLockedText { get; set; }Indicates whether the shape is locked when worksheet is protected.
IsTextWrapped { get; set; }Gets or sets the text wrapped type of the shape which contains text.
LeftMarginPt { get; set; }Returns the left margin in unit of Points
NumberOfColumns { get; set; }Gets and sets the number of columns of text in the bounding rectangle.
RightMarginPt { get; set; }Returns the right margin in unit of Points
RotateTextWithShape { get; set; }Indicates whether rotating text with shape.
RotationAngle { get; set; }Gets and sets the rotation of the shape.
TextHorizontalOverflow { get; set; }Gets and sets the text horizontal overflow type of the text box.
TextShapeType { get; set; }Gets and set the transform type of text.
TextVerticalOverflow { get; set; }Gets and sets the text vertical overflow type of the text box.
TextVerticalType { get; set; }Gets and sets the text direction.
TopMarginPt { get; set; }Returns the top margin in unit of Points

Methods

NameDescription
override Equals(object)Determines whether this instance has the same value as another specified ShapeTextAlignment object.
override GetHashCode()

Examples

namespace AsposeCellsExamples
{
    using Aspose.Cells;
    using Aspose.Cells.Drawing;
    using Aspose.Cells.Drawing.Texts;
    using System;

    public class ShapeTextAlignmentDemo
    {
        public static void ShapeTextAlignmentExample()
        {
            // Instantiating a Workbook object
            Workbook workbook = new Workbook();
            Worksheet worksheet = workbook.Worksheets[0];

            // Adding a rectangle shape to the worksheet
            Shape shape = worksheet.Shapes.AddRectangle(1, 0, 1, 0, 50, 100);

            // Accessing the ShapeTextAlignment object
            ShapeTextAlignment shapeTextAlignment = shape.TextBody.TextAlignment;

            // Setting properties
            shapeTextAlignment.IsTextWrapped = true;
            shapeTextAlignment.RotateTextWithShape = true;
            shapeTextAlignment.TextVerticalOverflow = TextOverflowType.Clip;
            shapeTextAlignment.TextHorizontalOverflow = TextOverflowType.Clip;
            shapeTextAlignment.RotationAngle = 90;
            shapeTextAlignment.TextVerticalType = TextVerticalType.Horizontal;
            shapeTextAlignment.IsLockedText = false;
            shapeTextAlignment.AutoSize = false;
            shapeTextAlignment.TextShapeType = AutoShapeType.TextBox;
            shapeTextAlignment.TopMarginPt = 2.0d;
            shapeTextAlignment.BottomMarginPt = 2.0d;
            shapeTextAlignment.LeftMarginPt = 2.0d;
            shapeTextAlignment.RightMarginPt = 2.0d;
            shapeTextAlignment.IsAutoMargin = true;
            shapeTextAlignment.NumberOfColumns = 1;

            // Saving the workbook
            workbook.Save("ShapeTextAlignmentExample.xlsx");

            return;
        }
    }
}

See Also