class Axlsx::SheetView
View options for a worksheet.
@note The recommended way to manage the sheet view is via Worksheet#sheet_view
@see Worksheet#sheet_view
Constants
- CHILD_ELEMENTS
instance values that must be serialized as their own elements - e.g. not attributes.
Attributes
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. @see type @return [Integer] default nil
A hash of selection objects keyed by pane type associated with this sheet view. @return [Hash]
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). @see type @return [String] default nil
View Type Indicates the view type. Options are
* normal: Normal view * page_break_preview: Page break preview * page_layout: Page Layout View
@see type @return [Symbol] default :normal
Workbook
View Index Zero-based index of this workbook view, pointing to a workbookView element in the bookViews collection. @see type @return [Integer] default 0
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. @see type @return [Integer] default 100
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. @see type @return [Integer] default 0
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. @see type @return [Integer] default 0
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. @see type @return [Integer] default 0
Public Class Methods
Creates a new {SheetView} object @option options [Integer] color_id
Color
Id @option options [Boolean] default_grid_color Default
Grid Color
@option options [Boolean] right_to_left Right To Left @option options [Boolean] show_formulas Show Formulas @option options [Boolean] show_grid_lines Show Grid Lines @option options [Boolean] show_outline_symbols Show Outline Symbols @option options [Boolean] show_row_col_headers Show Headers @option options [Boolean] show_ruler Show Ruler @option options [Boolean] show_white_space Show White Space @option options [Boolean] show_zeros Show Zero Values @option options [Boolean] tab_selected Sheet Tab Selected @option options [String, Cell] top_left_cell
Top Left Visible Cell
@option options [Symbol] view View Type @option options [Boolean] window_protection Window Protection @option options [Integer] workbook_view_id
Workbook
View Index @option options [Integer] zoom_scale
@option options [Integer] zoom_scale_normal
Zoom Scale Normal View @option options [Integer] zoom_scale_page_layout_view
Zoom Scale Page Layout View @option options [Integer] zoom_scale_sheet_layout_view
Zoom Scale Page Break
Preview
# File lib/axlsx/workbook/worksheet/sheet_view.rb, line 33 def initialize(options={}) #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 = {} parse_options options end
Public Instance Methods
Adds a new selection param [Symbol] pane param [Hash] options return [Selection]
# File lib/axlsx/workbook/worksheet/sheet_view.rb, line 165 def add_selection(pane, options = {}) @selections[pane] = Selection.new(options.merge(:pane => pane)) end
@see color_id
# File lib/axlsx/workbook/worksheet/sheet_view.rb, line 170 def color_id=(v); Axlsx::validate_unsigned_int(v); @color_id = v end
The pane object for the sheet view @return [Pane] @see [Pane]
# File lib/axlsx/workbook/worksheet/sheet_view.rb, line 59 def pane @pane ||= Pane.new yield @pane if block_given? @pane end
Serializes the data validation @param [String] str @return [String]
# File lib/axlsx/workbook/worksheet/sheet_view.rb, line 200 def to_xml_string(str = '') str << '<sheetViews>' str << '<sheetView ' serialized_attributes str str << '>' @pane.to_xml_string(str) if @pane @selections.each do |key, selection| selection.to_xml_string(str) end str << '</sheetView>' str << '</sheetViews>' end
@see top_left_cell
# File lib/axlsx/workbook/worksheet/sheet_view.rb, line 173 def top_left_cell=(v) cell = (v.class == Axlsx::Cell ? v.r_abs : v) Axlsx::validate_string(cell) @top_left_cell = cell end
@see view
# File lib/axlsx/workbook/worksheet/sheet_view.rb, line 180 def view=(v); Axlsx::validate_sheet_view_type(v); @view = v end
@see workbook_view_id
# File lib/axlsx/workbook/worksheet/sheet_view.rb, line 183 def workbook_view_id=(v); Axlsx::validate_unsigned_int(v); @workbook_view_id = v end
@see zoom_scale
# File lib/axlsx/workbook/worksheet/sheet_view.rb, line 186 def zoom_scale=(v); Axlsx::validate_scale_0_10_400(v); @zoom_scale = v end
@see zoom_scale_normal
# File lib/axlsx/workbook/worksheet/sheet_view.rb, line 189 def zoom_scale_normal=(v); Axlsx::validate_scale_0_10_400(v); @zoom_scale_normal = v end
@see zoom_scale_page_layout_view
# File lib/axlsx/workbook/worksheet/sheet_view.rb, line 192 def zoom_scale_page_layout_view=(v); Axlsx::validate_scale_0_10_400(v); @zoom_scale_page_layout_view = v end
@see zoom_scale_sheet_layout_view
# File lib/axlsx/workbook/worksheet/sheet_view.rb, line 195 def zoom_scale_sheet_layout_view=(v); Axlsx::validate_scale_0_10_400(v); @zoom_scale_sheet_layout_view = v end