class Axlsx::SheetPr

The SheetPr class manages serialization of a worksheet's sheetPr element.

Attributes

tab_color[R]

The tab color of the sheet. @return [Color]

worksheet[R]

The worksheet these properties apply to! @return [Worksheet]

Public Class Methods

new(worksheet, options={}) click to toggle source

Creates a new SheetPr object @param [Worksheet] worksheet The worksheet that owns this SheetPr object

# File lib/axlsx/workbook/worksheet/sheet_pr.rb, line 33
def initialize(worksheet, options={})
  raise ArgumentError, "you must provide a worksheet" unless worksheet.is_a?(Worksheet)
  @worksheet = worksheet
  @outline_pr = nil
  parse_options options
end

Public Instance Methods

outline_pr() click to toggle source

The OutlinePr for this sheet pr object @return [OutlinePr]

# File lib/axlsx/workbook/worksheet/sheet_pr.rb, line 68
def outline_pr
  @outline_pr ||= OutlinePr.new
end
page_setup_pr() click to toggle source

The PageSetUpPr for this sheet pr object @return [PageSetUpPr]

# File lib/axlsx/workbook/worksheet/sheet_pr.rb, line 62
def page_setup_pr
  @page_setup_pr ||= PageSetUpPr.new
end
tab_color=(v) click to toggle source

@see tab_color

# File lib/axlsx/workbook/worksheet/sheet_pr.rb, line 73
def tab_color=(v)
  @tab_color ||= Color.new(:rgb => v)
end
to_xml_string(str = '') click to toggle source

Serialize the object @param [String] str serialized output will be appended to this object if provided. @return [String]

# File lib/axlsx/workbook/worksheet/sheet_pr.rb, line 51
def to_xml_string(str = '')
  update_properties
  str << "<sheetPr #{serialized_attributes}>"
  tab_color.to_xml_string(str, 'tabColor') if tab_color
  outline_pr.to_xml_string(str) if @outline_pr
  page_setup_pr.to_xml_string(str)
  str << "</sheetPr>"
end

Private Instance Methods

update_properties() click to toggle source
# File lib/axlsx/workbook/worksheet/sheet_pr.rb, line 79
def update_properties
  page_setup_pr.fit_to_page = worksheet.fit_to_page?
  if worksheet.auto_filter.columns.size > 0
    self.filter_mode = 1
    self.enable_format_conditions_calculation = 1
  end
end