[Table of Contents] [docx version]
SpreadsheetML Reference Material - Table of Contents
ST_HorizontalAlignment (Horizontal Alignment Type)
The enumeration value indicating the portion of Cell Alignment in a cell format (XF) that is horizontal alignment, i.e., whether it is aligned general, left, right, horizontally centered, filled (replicated), justified, centered across multiple cells, or distributed.
This simple type's contents are a restriction of the XML Schema string datatype.
The following are possible enumeration values for this type:
Enumeration Value |
Description |
center (Centered Horizontal Alignment) |
The horizontal alignment is centered, meaning the text is centered across the cell. |
centerContinuous (Center Continuous Horizontal Alignment) |
The horizontal alignment is centered across multiple cells. The information about how many cells to span is expressed in the Sheet Part, in the row of the cell in question. For each cell that is spanned in the alignment, a cell element needs to be written out, with the same style Id which references the centerContinuous alignment.
[Example: This shows the value of A1 centered across A1:C1:
The XML from the Sheet Part:
<row r="1" spans="1:3"> The XML from the Styles Part:
<cellXfs count="2">
end example]
|
distributed (Distributed Horizontal Alignment) |
I/ndicates that each 'word' in each line of text inside the cell is evenly distributed across the width of the cell, with flush right and left margins.
When there is also an indent value to apply, both the left and right side of the cell are padded by the indent value.
A 'word' is a set of characters with no space character in them.
Two lines inside a cell are separated by a carriage return.
[Example: This shows three lines of text evenly distributed horizontally across the cell. The first line is "abc def ghi", the second line is blank, and the third line is "jkl mno".
This shows the same example, with an indent value of 2:
Note: there is no vertical component to the alignment being shown here. The row has been manually adjusted to display the text. end example]
|
fill (Fill) |
Indicates that the value of the cell should be filled across the entire width of the cell. If blank cells to the right also have the fill alignment, they are also filled with the value, using a convention similar to centerContinuous.
Additional rules: • Only whole values can be appended, not partial values. • The column will not be widened to 'best fit' the filled value • If appending an additional occurrence of the value exceeds the boundary of the cell left/right edge, don't append the additional occurrence of the value. • The display value of the cell is filled, not the underlying raw number. [Example: This cell is filled with the value 1.2345 and has a width of 15 characters:
This cell is filled with the value abc and has width of 15 characters:
end example]
|
general (General Horizontal Alignment) |
The horizontal alignment is general-aligned. Text data is left-aligned. Numbers, dates, and times are right-aligned. Boolean types are centered. Changing the alignment does not change the type of data.
[Example: These cells are general aligned:
end example]
|
justify (Justify) |
The horizontal alignment is justified (flush left and right). For each line of text, aligns each line of the wrapped text in a cell to the right and left (except the last line). If no single line of text wraps in the cell, then the text is not justified.
[Example: There are two lines of text in this cell, and the cell's horizontal alignment is justify:
end example]
|
left (Left Horizontal Alignment) |
The horizontal alignment is left-aligned, even in Right-to-Left mode. Aligns contents at the left edge of the cell. If an indent amount is specified, the contents of the cell is indented from the left by the specified number of character spaces. The character spaces are based on the default font and font size for the workbook. |
right (Right Horizontal Alignment) |
The horizontal alignment is right-aligned, meaning that cell contents are aligned at the right edge of the cell, even in Right-to-Left mode. |
Referenced By |
alignment@horizontal (§3.8.1) |
The following XML Schema fragment defines the contents of this simple type:
<simpleType name="ST_HorizontalAlignment">
<restriction base="xsd:string">
<enumeration value="general"/>
<enumeration value="center"/>
<enumeration value="justify"/>
<enumeration value="centerContinuous"/>
<enumeration value="distributed"/>
</restriction>
</simpleType>