Class: Axlsx::SheetView
- Inherits:
-
Object
- Object
- Axlsx::SheetView
- Defined in:
- lib/axlsx/workbook/worksheet/sheet_view.rb
Overview
The recommended way to manage the sheet view is via Worksheet#sheet_view
View options for a worksheet.
Constant Summary collapse
- CHILD_ELEMENTS =
instance values that must be serialized as their own elements - e.g. not attributes.
[ :pane, :selections ]
Instance Attribute Summary collapse
-
#color_id ⇒ Integer
Color Id Index to the color value for row/column text headings and gridlines.
-
#default_grid_color ⇒ Boolean
Default Grid Color Flag indicating that the consuming application should use the default grid lines color (system dependent).
-
#right_to_left ⇒ Boolean
Right To Left Flag indicating whether the sheet is in 'right to left' display mode.
-
#selections ⇒ Hash
readonly
A hash of selection objects keyed by pane type associated with this sheet view.
-
#show_formulas ⇒ Boolean
Show Formulas Flag indicating whether this sheet should display formulas.
-
#show_grid_lines ⇒ Boolean
Show Grid Lines Flag indicating whether this sheet should display gridlines.
-
#show_outline_symbols ⇒ Boolean
Show Outline Symbols Flag indicating whether the sheet has outline symbols visible.
-
#show_row_col_headers ⇒ Boolean
Show Headers Flag indicating whether the sheet should display row and column headings.
-
#show_ruler ⇒ Boolean
Show Ruler Show the ruler in Page Layout View.
-
#show_white_space ⇒ Boolean
Show White Space Flag indicating whether page layout view shall display margins.
-
#show_zeros ⇒ Boolean
Show Zero Values Flag indicating whether the window should show 0 (zero) in cells containing zero value.
-
#tab_selected ⇒ Boolean
Sheet Tab Selected Flag indicating whether this sheet is selected.
-
#top_left_cell ⇒ String
Top Left Visible Cell Location of the top left visible cell Location of the top left visible cell in the bottom right pane (when in Left-to-Right mode).
-
#view ⇒ Symbol
View Type Indicates the view type.
-
#window_protection ⇒ Boolean
Window Protection Flag indicating whether the panes in the window are locked due to workbook protection.
-
#workbook_view_id ⇒ Integer
Workbook View Index Zero-based index of this workbook view, pointing to a workbookView element in the bookViews collection.
-
#zoom_scale ⇒ Integer
Zoom Scale Window zoom magnification for current view representing percent values.
-
#zoom_scale_normal ⇒ Integer
Zoom Scale Normal View Zoom magnification to use when in normal view, representing percent values.
-
#zoom_scale_page_layout_view ⇒ Integer
Zoom Scale Page Layout View Zoom magnification to use when in page layout view, representing percent values.
-
#zoom_scale_sheet_layout_view ⇒ Integer
Zoom Scale Page Break Preview Zoom magnification to use when in page break preview, representing percent values.
Instance Method Summary collapse
-
#add_selection(pane, options = {}) ⇒ Object
Adds a new selection param [Symbol] pane param [Hash] options return [Selection].
-
#initialize(options = {}) ⇒ SheetView
constructor
Creates a new SheetView object.
-
#pane {|@pane| ... } ⇒ Pane
The pane object for the sheet view.
-
#to_xml_string(str = '') ⇒ String
Serializes the data validation.
Constructor Details
#initialize(options = {}) ⇒ SheetView
Creates a new Axlsx::SheetView object
259 260 261 262 263 264 265 266 267 268 269 270 271 272 |
# File 'lib/axlsx/workbook/worksheet/sheet_view.rb', line 259 def initialize(={}) #defaults @color_id = @top_left_cell = @pane = nil @right_to_left = @show_formulas = @show_outline_symbols = @show_white_space = @tab_selected = @window_protection = false @default_grid_color = @show_grid_lines = @show_row_col_headers = @show_ruler = @show_zeros = true @zoom_scale = 100 @zoom_scale_normal = @zoom_scale_page_layout_view = @zoom_scale_sheet_layout_view = @workbook_view_id = 0 @selections = {} # 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
#color_id ⇒ Integer
Color Id Index to the color value for row/column text headings and gridlines. This is an 'index color value' (ICV) rather than rgb value. default nil
34 35 36 |
# File 'lib/axlsx/workbook/worksheet/sheet_view.rb', line 34 def color_id @color_id end |
#default_grid_color ⇒ Boolean
Default Grid Color Flag indicating that the consuming application should use the default grid lines color (system dependent). Overrides any color specified in colorId. default true
45 46 47 |
# File 'lib/axlsx/workbook/worksheet/sheet_view.rb', line 45 def default_grid_color @default_grid_color end |
#right_to_left ⇒ Boolean
Right To Left Flag indicating whether the sheet is in 'right to left' display mode. When in this mode, Column A is on the far right, Column B ; is one column left of Column A, and so on. Also, information in cells is displayed in the Right to Left format. default false
58 59 60 |
# File 'lib/axlsx/workbook/worksheet/sheet_view.rb', line 58 def right_to_left @right_to_left end |
#selections ⇒ Hash (readonly)
A hash of selection objects keyed by pane type associated with this sheet view.
23 24 25 |
# File 'lib/axlsx/workbook/worksheet/sheet_view.rb', line 23 def selections @selections end |
#show_formulas ⇒ Boolean
Show Formulas Flag indicating whether this sheet should display formulas. default false
67 68 69 |
# File 'lib/axlsx/workbook/worksheet/sheet_view.rb', line 67 def show_formulas @show_formulas end |
#show_grid_lines ⇒ Boolean
Show Grid Lines Flag indicating whether this sheet should display gridlines. default true
76 77 78 |
# File 'lib/axlsx/workbook/worksheet/sheet_view.rb', line 76 def show_grid_lines @show_grid_lines end |
#show_outline_symbols ⇒ Boolean
Show Outline Symbols Flag indicating whether the sheet has outline symbols visible. This flag shall always override SheetPr element's outlinePr child element whose attribute is named showOutlineSymbols when there is a conflict. default false
88 89 90 |
# File 'lib/axlsx/workbook/worksheet/sheet_view.rb', line 88 def show_outline_symbols @show_outline_symbols end |
#show_row_col_headers ⇒ Boolean
Show Headers Flag indicating whether the sheet should display row and column headings. default true
97 98 99 |
# File 'lib/axlsx/workbook/worksheet/sheet_view.rb', line 97 def show_row_col_headers @show_row_col_headers end |
#show_ruler ⇒ Boolean
Show Ruler Show the ruler in Page Layout View. default true
105 106 107 |
# File 'lib/axlsx/workbook/worksheet/sheet_view.rb', line 105 def show_ruler @show_ruler end |
#show_white_space ⇒ Boolean
Show White Space Flag indicating whether page layout view shall display margins. False means do not display left, right, top (header), and bottom (footer) margins (even when there is data in the header or footer). default false
117 118 119 |
# File 'lib/axlsx/workbook/worksheet/sheet_view.rb', line 117 def show_white_space @show_white_space end |
#show_zeros ⇒ Boolean
Show Zero Values Flag indicating whether the window should show 0 (zero) in cells containing zero value. When false, cells with zero value appear blank instead of showing the number zero. default true
128 129 130 |
# File 'lib/axlsx/workbook/worksheet/sheet_view.rb', line 128 def show_zeros @show_zeros end |
#tab_selected ⇒ Boolean
Sheet Tab Selected Flag indicating whether this sheet is selected. When only 1 sheet is selected and active, this value should be in synch with the activeTab value. In case of a conflict, the Start Part setting wins and sets the active sheet tab. Multiple sheets can be selected, but only one sheet shall be active at one time. default false
142 143 144 |
# File 'lib/axlsx/workbook/worksheet/sheet_view.rb', line 142 def tab_selected @tab_selected end |
#top_left_cell ⇒ String
Top Left Visible Cell Location of the top left visible cell Location of the top left visible cell in the bottom right pane (when in Left-to-Right mode). default nil
152 153 154 |
# File 'lib/axlsx/workbook/worksheet/sheet_view.rb', line 152 def top_left_cell @top_left_cell end |
#view ⇒ Symbol
View Type Indicates the view type. Options are
- normal: Normal view
- page_break_preview: Page break preview
- page_layout: Page Layout View default :normal
164 165 166 |
# File 'lib/axlsx/workbook/worksheet/sheet_view.rb', line 164 def view @view end |
#window_protection ⇒ Boolean
Window Protection Flag indicating whether the panes in the window are locked due to workbook protection. This is an option when the workbook structure is protected. default true
175 176 177 |
# File 'lib/axlsx/workbook/worksheet/sheet_view.rb', line 175 def window_protection @window_protection end |
#workbook_view_id ⇒ Integer
Workbook View Index Zero-based index of this workbook view, pointing to a workbookView element in the bookViews collection. default 0
184 185 186 |
# File 'lib/axlsx/workbook/worksheet/sheet_view.rb', line 184 def workbook_view_id @workbook_view_id end |
#zoom_scale ⇒ Integer
Zoom Scale Window zoom magnification for current view representing percent values. This attribute is restricted to values ranging from 10 to 400. Horizontal & Vertical scale together. Current view can be Normal, Page Layout, or Page Break Preview. default 100
197 198 199 |
# File 'lib/axlsx/workbook/worksheet/sheet_view.rb', line 197 def zoom_scale @zoom_scale end |
#zoom_scale_normal ⇒ Integer
Zoom Scale Normal View Zoom magnification to use when in normal view, representing percent values. This attribute is restricted to values ranging from 10 to 400. Horizontal & Vertical scale together. Applies for worksheets only; zero implies the automatic setting. default 0
210 211 212 |
# File 'lib/axlsx/workbook/worksheet/sheet_view.rb', line 210 def zoom_scale_normal @zoom_scale_normal end |
#zoom_scale_page_layout_view ⇒ Integer
Zoom Scale Page Layout View Zoom magnification to use when in page layout view, representing percent values. This attribute is restricted to values ranging from 10 to 400. Horizontal & Vertical scale together. Applies for worksheets only; zero implies the automatic setting. default 0
223 224 225 |
# File 'lib/axlsx/workbook/worksheet/sheet_view.rb', line 223 def zoom_scale_page_layout_view @zoom_scale_page_layout_view end |
#zoom_scale_sheet_layout_view ⇒ Integer
Zoom Scale Page Break Preview Zoom magnification to use when in page break preview, representing percent values. This attribute is restricted to values ranging from 10 to 400. Horizontal & Vertical scale together. Applies for worksheet only; zero implies the automatic setting. default 0
237 238 239 |
# File 'lib/axlsx/workbook/worksheet/sheet_view.rb', line 237 def zoom_scale_sheet_layout_view @zoom_scale_sheet_layout_view end |
Instance Method Details
#add_selection(pane, options = {}) ⇒ Object
Adds a new selection param [Symbol] pane param [Hash] options return [Selection]
279 280 281 |
# File 'lib/axlsx/workbook/worksheet/sheet_view.rb', line 279 def add_selection(pane, = {}) @selections[pane] = Selection.new(.merge(:pane => pane)) end |
#pane {|@pane| ... } ⇒ Pane
The pane object for the sheet view
15 16 17 18 19 |
# File 'lib/axlsx/workbook/worksheet/sheet_view.rb', line 15 def pane @pane ||= Pane.new yield @pane if block_given? @pane end |
#to_xml_string(str = '') ⇒ String
Serializes the data validation
366 367 368 369 370 371 372 373 374 375 376 377 |
# File 'lib/axlsx/workbook/worksheet/sheet_view.rb', line 366 def to_xml_string(str = '') str << '<sheetViews>' str << '<sheetView ' str << instance_values.map { |key, value| (Axlsx::camel(key.to_s, false) << '="' << value.to_s << '"') unless CHILD_ELEMENTS.include?(key.to_sym) || value == nil }.join(' ') str << '>' @pane.to_xml_string(str) if @pane @selections.each do |key, selection| selection.to_xml_string(str) end str << '</sheetView>' str << '</sheetViews>' end |