Share via


Alignment Class

Alignment.When the object is serialized out as xml, its qualified name is x:alignment.

Inheritance Hierarchy

System.Object
  DocumentFormat.OpenXml.OpenXmlElement
    DocumentFormat.OpenXml.OpenXmlLeafElement
      DocumentFormat.OpenXml.Spreadsheet.Alignment

Namespace:  DocumentFormat.OpenXml.Spreadsheet
Assembly:  DocumentFormat.OpenXml (in DocumentFormat.OpenXml.dll)

Syntax

'Declaration
Public Class Alignment _
    Inherits OpenXmlLeafElement
'Usage
Dim instance As Alignment
public class Alignment : OpenXmlLeafElement

Remarks

[ISO/IEC 29500-1 1st Edition]

18.8.1 alignment (Alignment)

Formatting information pertaining to text alignment in cells. There are a variety of choices for how text is aligned both horizontally and vertically, as well as indentation settings, and so on.

Parent Elements

dxf (§18.8.14); ndxf (§18.11.1.4); odxf (§18.11.1.6); xf (§18.8.45)

Attributes

Description

horizontal (Horizontal Alignment)

Specifies the type of horizontal alignment in cells.

The possible values for this attribute are defined by the ST_HorizontalAlignment simple type (§18.18.40).

indent (Indent)

An integer value, where an increment of 1 represents 3 spaces. Indicates the number of spaces (of the normal style font) of indentation for text in a cell. The number of spaces to indent is calculated as following:

Number of spaces to indent = indent value * 3

[Example:For example, an indent value of '1' means that the text begins 3 space widths (of the normal style font) from the edge of the cell.

end example]

[Note: The width of one space character is defined by the font. end note]

Only left, right, and distributed horizontal alignments are supported.

The possible values for this attribute are defined by the W3C XML Schema unsignedInt datatype.

justifyLastLine (Justify Last Line)

A boolean value indicating if the cells justified or distributed alignment should be used on the last line of text. (This is typical for East Asian alignments but not typical in other contexts.)

The possible values for this attribute are defined by the W3C XML Schema boolean datatype.

readingOrder (Reading Order)

An integer value indicating whether the reading order (bidirectionality) of the cell is left-to-right, right-to-left, or context dependent.

0 - Context Dependent - reading order is determined by scanning the text for the first non-whitespace character: if it is a strong right-to-left character, the reading order is right-to-left; otherwise, the reading order left-to-right.

1 - Left-to-Right- reading order is left-to-right in the cell, as in English.

2 - Right-to-Left - reading order is right-to-left in the cell, as in Hebrew.

The possible values for this attribute are defined by the W3C XML Schema unsignedInt datatype.

relativeIndent (Relative Indent)

An integer value (used only in a dxf element) to indicate the additional number of spaces of indentation to adjust for text in a cell.

The possible values for this attribute are defined by the W3C XML Schema int datatype.

shrinkToFit (Shrink To Fit)

A boolean value indicating if the displayed text in the cell should be shrunk to fit the cell width. Not applicable when a cell contains multiple lines of text.

The possible values for this attribute are defined by the W3C XML Schema boolean datatype.

textRotation (Text Rotation)

Text rotation in cells. Expressed in degrees. Values range from 0 to 180. The first letter of the text is considered the center-point of the arc.

For 0 - 90, the value represents degrees above horizon. For 91-180 the degrees below the horizon is calculated as:

[degrees below horizon] = 90 - textRotation.

0

DocumentFormat.OpenXml.Spreadsheet.Alignment-image

45

DocumentFormat.OpenXml.Spreadsheet.Alignment-image

90

DocumentFormat.OpenXml.Spreadsheet.Alignment-image

135

DocumentFormat.OpenXml.Spreadsheet.Alignment-image

180

DocumentFormat.OpenXml.Spreadsheet.Alignment-image

The possible values for this attribute are defined by the W3C XML Schema unsignedInt datatype.

vertical (Vertical Alignment)

Vertical alignment in cells.

The possible values for this attribute are defined by the ST_VerticalAlignment simple type (§18.18.88).

wrapText (Wrap Text)

A boolean value indicating if the text in a cell should be line-wrapped within the cell.

The possible values for this attribute are defined by the W3C XML Schema boolean datatype.

[Note: The W3C XML Schema definition of this element’s content model (CT_CellAlignment) is located in §A.2. end note]

© ISO/IEC29500: 2008.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

Alignment Members

DocumentFormat.OpenXml.Spreadsheet Namespace