CellAlignment

Revision as of 19:13, 31 August 2023 by Lchrisman (talk | contribs) (ER 20200 cont)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)



Release:

4.6  •  5.0  •  5.1  •  5.2  •  5.3  •  5.4  •  6.0  •  6.1  •  6.2  •  6.3  •  6.4  •  6.5


New to Analytica 5.0

CellAlignment( horiz, indent, vert, vertIndent, wrap, hybridFlags )

Specifies the text alignment (justification) or indention for a cell in a table. This is used from within a Cell Format Expression attribute, see Computed cell formats for an overview of using computed formats.

Parameters:

  • «horiz»: The horizontal alignment. One of: 'Left', 'Center', 'Right', 'Default'or 'Hybrid'.
  • «indent»: An indention amount, in units equal to the width of one space character. For 'Left' alignment, this is a margin to the left of the text, for 'Right' it is a margin to the right of the text, and for 'Center' it is a margin on both sides.
  • «vert»: The vertical alignment. One of 'Top', 'Middle', 'Bottom' or 'Default'.
  • «vertIndent»: Vertical margin in pixel units. For 'Top', this is a margin above the text, for 'Bottom' it is a margin below the text, and for 'Middle' it is a margin on both sides.
  • «wrap»: (new to Analytica 6.4) Specifies whether long text should be word-wrapped (the default starting in Analytica 6.4).
  • «hybridFlags»: (new to Analytica 6.4) A bit field that is only used when you set «horiz» to 'Hybrid'. The cell content types set here are right-justified, those not set are left-justified. The bits are:
    1 = Numbers
    2 = Dates and times
    4 = Single-line text
    8 = Multi-line text
    16 = Nulls
    32 = Handles
    1024 = Other

The «horiz» and «vert» parameters also accept 'Justify', 'Fill', and 'Distributed'. However, these modes are not honored -- instead it just maps to the most appropriate justification among the stated options. When reading cell justifications in an excel spreadsheet, these values are possible (e.g., from SpreadsheetCell with «what» set to 'HorizontalAlignment' or 'VerticalAlignment').

When «horiz» is 'Default' it right or left aligns cell content based on the data type displayed in the cell, and whether it is single or multiline content In Analytica 6.4, the system variable Sys_CellAlignmentHybridDefault determines this mapping globally (and can be changed). When «horiz» is set to 'Hybrid' it also right or left justifies cell content based on the data type, but uses the «hybridFlags» parameter to determine which types should be right aligned.

Examples

These would appear in the Cell Format Expression attribute.

CellAlignment( 'Center' )
CellAlignment( If IsNumber(Self) Then 'Right' Else 'Left' )

The previous example can also be accomplished using

CellAlignment( 'Hybrid', hybridFlags:1 )
CellSpan( LineItem, CellAlignment(vert:'Middle'), header:true )

In the next example, there is an index named Place, and a variable Place_level indexed by Place, with a 0 for each state, a 1 for each county, and a 2 for each city.

CellSpan(Place, CellAlignment(indent:Place_level*3), header:true)

:CellAlignment OutlineIndentation.png

See Also

Comments


You are not allowed to post comments.