Class: Axlsx::SheetPr

Inherits:
Object
  • Object
show all
Includes:
Accessors, OptionsParser, SerializedAttributes
Defined in:
lib/axlsx/workbook/worksheet/sheet_pr.rb

Overview

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from SerializedAttributes

#declared_attributes, included, #serialized_attributes, #serialized_element_attributes, #serialized_tag

Methods included from OptionsParser

#parse_options

Constructor Details

#initialize(worksheet, options = {}) ⇒ SheetPr

Creates a new SheetPr object

Parameters:

  • worksheet (Worksheet)

    The worksheet that owns this SheetPr object

Raises:

  • (ArgumentError)


33
34
35
36
37
38
# 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

Instance Attribute Details

#tab_colorColor

The tab color of the sheet.

Returns:



46
47
48
# File 'lib/axlsx/workbook/worksheet/sheet_pr.rb', line 46

def tab_color
  @tab_color
end

#worksheetWorksheet (readonly)

The worksheet these properties apply to!

Returns:



42
43
44
# File 'lib/axlsx/workbook/worksheet/sheet_pr.rb', line 42

def worksheet
  @worksheet
end

Instance Method Details

#outline_prOutlinePr

The OutlinePr for this sheet pr object

Returns:



68
69
70
# File 'lib/axlsx/workbook/worksheet/sheet_pr.rb', line 68

def outline_pr
  @outline_pr ||= OutlinePr.new
end

#page_setup_prPageSetUpPr

The PageSetUpPr for this sheet pr object

Returns:



62
63
64
# File 'lib/axlsx/workbook/worksheet/sheet_pr.rb', line 62

def page_setup_pr
  @page_setup_pr ||= PageSetUpPr.new
end

#to_xml_string(str = '') ⇒ String

Serialize the object

Parameters:

  • str (String) (defaults to: '')

    serialized output will be appended to this object if provided.

Returns:

  • (String)


51
52
53
54
55
56
57
58
# 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