Class: Axlsx::CellAlignment

Inherits:
Object
  • Object
show all
Includes:
OptionsParser, SerializedAttributes
Defined in:
lib/axlsx/stylesheet/cell_alignment.rb

Overview

Note:

Using Styles#add_style is the recommended way to manage cell alignment.

CellAlignment stores information about the cell alignment of a style Xf Object.

See Also:

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from OptionsParser

#parse_options

Methods included from SerializedAttributes

#declared_attributes, included, #serialized_attributes, #serialized_element_attributes, #serialized_tag

Constructor Details

#initialize(options = {}) ⇒ CellAlignment

Create a new cell_alignment object

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • horizontal (Symbol)
  • vertical (Symbol)
  • text_rotation (Integer)
  • wrap_text (Boolean)
  • indent (Integer)
  • relative_indent (Integer)
  • justify_last_line (Boolean)
  • shrink_to_fit (Boolean)
  • reading_order (Integer)


20
21
22
# File 'lib/axlsx/stylesheet/cell_alignment.rb', line 20

def initialize(options = {})
  parse_options options
end

Instance Attribute Details

#horizontalSymbol

Note:

The horizontal cell alignement style must be one of :general :left :center :right :fill :justify :centerContinuous :distributed

The horizontal alignment of the cell.

Returns:

  • (Symbol)


36
37
38
# File 'lib/axlsx/stylesheet/cell_alignment.rb', line 36

def horizontal
  @horizontal
end

#indentInteger

The amount of indent

Returns:

  • (Integer)


61
62
63
# File 'lib/axlsx/stylesheet/cell_alignment.rb', line 61

def indent
  @indent
end

#justify_last_lineBoolean Also known as: justifyLastLine

Indicate if the last line should be justified.

Returns:

  • (Boolean)


70
71
72
# File 'lib/axlsx/stylesheet/cell_alignment.rb', line 70

def justify_last_line
  @justify_last_line
end

#reading_orderInteger Also known as: readingOrder

The reading order of the text 0 Context Dependent 1 Left-to-Right 2 Right-to-Left

Returns:

  • (Integer)


83
84
85
# File 'lib/axlsx/stylesheet/cell_alignment.rb', line 83

def reading_order
  @reading_order
end

#relative_indentInteger Also known as: relativeIndent

The amount of relativeIndent

Returns:

  • (Integer)


65
66
67
# File 'lib/axlsx/stylesheet/cell_alignment.rb', line 65

def relative_indent
  @relative_indent
end

#shrink_to_fitBoolean Also known as: shrinkToFit

Indicate if the text should be shrunk to the fit in the cell.

Returns:

  • (Boolean)


75
76
77
# File 'lib/axlsx/stylesheet/cell_alignment.rb', line 75

def shrink_to_fit
  @shrink_to_fit
end

#text_rotationInteger Also known as: textRotation

The textRotation of the cell.

Returns:

  • (Integer)


51
52
53
# File 'lib/axlsx/stylesheet/cell_alignment.rb', line 51

def text_rotation
  @text_rotation
end

#verticalSymbol

Note:

The vertical cell allingment style must be one of the following: :top :center :bottom :justify :distributed

The vertical alignment of the cell.

Returns:

  • (Symbol)


47
48
49
# File 'lib/axlsx/stylesheet/cell_alignment.rb', line 47

def vertical
  @vertical
end

#wrap_textBoolean Also known as: wrapText

Indicate if the text of the cell should wrap

Returns:

  • (Boolean)


56
57
58
# File 'lib/axlsx/stylesheet/cell_alignment.rb', line 56

def wrap_text
  @wrap_text
end

Instance Method Details

#to_xml_string(str = '') ⇒ String

Serializes the object

Parameters:

  • str (String) (defaults to: '')

Returns:

  • (String)


120
121
122
# File 'lib/axlsx/stylesheet/cell_alignment.rb', line 120

def to_xml_string(str = '')
  serialized_tag('alignment', str)
end