Class: Axlsx::Pane
- Inherits:
-
Object
- Object
- Axlsx::Pane
- Defined in:
- lib/axlsx/workbook/worksheet/pane.rb
Overview
The recommended way to manage the pane options is via SheetView#pane
Pane options for a worksheet.
Instance Attribute Summary collapse
-
#active_pane ⇒ Symbol
Active Pane The pane that is active.
-
#state ⇒ Symbol
Split State Indicates whether the pane has horizontal / vertical splits, and whether those splits are frozen.
-
#top_left_cell ⇒ String
Top Left Visible Cell Location of the top left visible cell in the bottom right pane (when in Left-To-Right mode).
-
#x_split ⇒ Integer
Horizontal Split Position Horizontal position of the split, in 1/20th of a point; 0 (zero) if none.
-
#y_split ⇒ Integer
Vertical Split Position Vertical position of the split, in 1/20th of a point; 0 (zero) if none.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Pane
constructor
Creates a new Pane object.
-
#to_xml_string(str = '') ⇒ String
Serializes the data validation.
Constructor Details
#initialize(options = {}) ⇒ Pane
Creates a new Axlsx::Pane object
91 92 93 94 95 96 97 98 99 100 |
# File 'lib/axlsx/workbook/worksheet/pane.rb', line 91 def initialize(={}) #defaults @active_pane = @state = @top_left_cell = nil @x_split = @y_split = 0 # write options to instance variables .each do |o| self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}=" end end |
Instance Attribute Details
#active_pane ⇒ Symbol
Active Pane The pane that is active. Options are
- bottom_left: Bottom left pane, when both vertical and horizontal splits are applied. This value is also used when only a horizontal split has been applied, dividing the pane into upper and lower regions. In that case, this value specifies the bottom pane.
- bottom_right: Bottom right pane, when both vertical and horizontal splits are applied.
- top_left: Top left pane, when both vertical and horizontal splits are applied. This value is also used when only a horizontal split has been applied, dividing the pane into upper and lower regions. In that case, this value specifies the top pane. This value is also used when only a vertical split has been applied, dividing the pane into right and left regions. In that case, this value specifies the left pane
- top_right: Top right pane, when both vertical and horizontal splits are applied. This value is also used when only a vertical split has been applied, dividing the pane into right and left regions. In that case, this value specifies the right pane. default nil
34 35 36 |
# File 'lib/axlsx/workbook/worksheet/pane.rb', line 34 def active_pane @active_pane end |
#state ⇒ Symbol
Split State Indicates whether the pane has horizontal / vertical splits, and whether those splits are frozen. Options are
- frozen: Panes are frozen, but were not split being frozen. In this state, when the panes are unfrozen again, a single pane results, with no split. In this state, the split bars are not adjustable.
- frozen_split: Panes are frozen and were split before being frozen. In this state, when the panes are unfrozen again, the split remains, but is adjustable.
- split: Panes are split, but not frozen. In this state, the split bars are adjustable by the user. default nil
53 54 55 |
# File 'lib/axlsx/workbook/worksheet/pane.rb', line 53 def state @state end |
#top_left_cell ⇒ String
Top Left Visible Cell Location of the top left visible cell in the bottom right pane (when in Left-To-Right mode). default nil
62 63 64 |
# File 'lib/axlsx/workbook/worksheet/pane.rb', line 62 def top_left_cell @top_left_cell end |
#x_split ⇒ Integer
Horizontal Split Position Horizontal position of the split, in 1/20th of a point; 0 (zero) if none. If the pane is frozen, this value indicates the number of columns visible in the top pane. default 0
72 73 74 |
# File 'lib/axlsx/workbook/worksheet/pane.rb', line 72 def x_split @x_split end |
#y_split ⇒ Integer
Vertical Split Position Vertical position of the split, in 1/20th of a point; 0 (zero) if none. If the pane is frozen, this value indicates the number of rows visible in the left pane. default 0
82 83 84 |
# File 'lib/axlsx/workbook/worksheet/pane.rb', line 82 def y_split @y_split end |
Instance Method Details
#to_xml_string(str = '') ⇒ String
Serializes the data validation
130 131 132 133 134 135 136 137 138 139 140 141 142 |
# File 'lib/axlsx/workbook/worksheet/pane.rb', line 130 def to_xml_string(str = '') if @state == :frozen && @top_left_cell.nil? row = @y_split || 0 column = @x_split || 0 @top_left_cell = "#{('A'..'ZZ').to_a[column]}#{row+1}" end str << '<pane ' str << instance_values.map { |key, value| '' << key.gsub(/_(.)/){ $1.upcase } << %{="#{[:active_pane, :state].include?(key.to_sym) ? value.to_s.gsub(/_(.)/){ $1.upcase } : value}"} unless value.nil? }.join(' ') str << '/>' end |