Class: Axlsx::CellAlignment
- Inherits:
-
Object
- Object
- Axlsx::CellAlignment
- Defined in:
- lib/axlsx/stylesheet/cell_alignment.rb
Overview
Using Styles#add_style is the recommended way to manage cell alignment.
CellAlignment stores information about the cell alignment of a style Xf Object.
Instance Attribute Summary collapse
-
#horizontal ⇒ Symbol
The horizontal alignment of the cell.
-
#indent ⇒ Integer
The amount of indent.
-
#justifyLastLine ⇒ Boolean
Indicate if the last line should be justified.
-
#readingOrder ⇒ Integer
The reading order of the text 0 Context Dependent 1 Left-to-Right 2 Right-to-Left.
-
#relativeIndent ⇒ Integer
The amount of relativeIndent.
-
#shrinkToFit ⇒ Boolean
Indicate if the text should be shrunk to the fit in the cell.
-
#textRotation ⇒ Integer
The textRotation of the cell.
-
#vertical ⇒ Symbol
The vertical alignment of the cell.
-
#wrapText ⇒ Boolean
Indicate if the text of the cell should wrap.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ CellAlignment
constructor
Create a new cell_alignment object.
-
#to_xml_string(str = '') ⇒ String
Serializes the object.
Constructor Details
#initialize(options = {}) ⇒ CellAlignment
Create a new cell_alignment object
73 74 75 76 77 |
# File 'lib/axlsx/stylesheet/cell_alignment.rb', line 73 def initialize(={}) .each do |o| self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}=" end end |
Instance Attribute Details
#horizontal ⇒ Symbol
The horizontal cell alignement style must be one of
:general
:left
:center
:right
:fill
:justify
:centerContinuous
:distributed
The horizontal alignment of the cell.
19 20 21 |
# File 'lib/axlsx/stylesheet/cell_alignment.rb', line 19 def horizontal @horizontal end |
#indent ⇒ Integer
The amount of indent
42 43 44 |
# File 'lib/axlsx/stylesheet/cell_alignment.rb', line 42 def indent @indent end |
#justifyLastLine ⇒ Boolean
Indicate if the last line should be justified.
50 51 52 |
# File 'lib/axlsx/stylesheet/cell_alignment.rb', line 50 def justifyLastLine @justifyLastLine end |
#readingOrder ⇒ Integer
The reading order of the text 0 Context Dependent 1 Left-to-Right 2 Right-to-Left
61 62 63 |
# File 'lib/axlsx/stylesheet/cell_alignment.rb', line 61 def readingOrder @readingOrder end |
#relativeIndent ⇒ Integer
The amount of relativeIndent
46 47 48 |
# File 'lib/axlsx/stylesheet/cell_alignment.rb', line 46 def relativeIndent @relativeIndent end |
#shrinkToFit ⇒ Boolean
Indicate if the text should be shrunk to the fit in the cell.
54 55 56 |
# File 'lib/axlsx/stylesheet/cell_alignment.rb', line 54 def shrinkToFit @shrinkToFit end |
#textRotation ⇒ Integer
The textRotation of the cell.
34 35 36 |
# File 'lib/axlsx/stylesheet/cell_alignment.rb', line 34 def textRotation @textRotation end |
#vertical ⇒ Symbol
The vertical cell allingment style must be one of the following:
:top
:center
:bottom
:justify
:distributed
The vertical alignment of the cell.
30 31 32 |
# File 'lib/axlsx/stylesheet/cell_alignment.rb', line 30 def vertical @vertical end |
#wrapText ⇒ Boolean
Indicate if the text of the cell should wrap
38 39 40 |
# File 'lib/axlsx/stylesheet/cell_alignment.rb', line 38 def wrapText @wrapText end |
Instance Method Details
#to_xml_string(str = '') ⇒ String
Serializes the object
101 102 103 104 105 |
# File 'lib/axlsx/stylesheet/cell_alignment.rb', line 101 def to_xml_string(str = '') str << '<alignment ' str << instance_values.map { |key, value| '' << key.to_s << '="' << value.to_s << '"' }.join(' ') str << '/>' end |