Class: Axlsx::SheetPr

Inherits:
Object
  • Object
show all
Defined in:
lib/axlsx/workbook/worksheet/sheet_pr.rb

Overview

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

Constant Summary collapse

BOOLEAN_ATTRIBUTES =

These attributes are all boolean so I'm doing a bit of a hand waving magic show to set up the attriubte accessors

[:sync_horizontal, 
:sync_vertical, 
:transtion_evaluation, 
:transition_entry,
:published,
:filter_mode,
:enable_format_conditions_calculation]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Creates a new SheetPr object

Parameters:

  • worksheet (Worksheet)

    The worksheet that owns this SheetPr object

Raises:

  • (ArgumentError)


20
21
22
23
24
25
26
27
# File 'lib/axlsx/workbook/worksheet/sheet_pr.rb', line 20

def initialize(worksheet, options={})
  raise ArgumentError, "you must provide a worksheet" unless worksheet.is_a?(Worksheet)
  @worksheet = worksheet
  options.each do |key, value|
    attr = "#{key}="  
    self.send(attr, value) if self.respond_to?(attr)
  end
end

Instance Attribute Details

#code_nameString

Anchor point for worksheet's window.

Returns:

  • (String)


48
49
50
# File 'lib/axlsx/workbook/worksheet/sheet_pr.rb', line 48

def code_name
  @code_name
end

#sync_refString

Specifies a stable name of the sheet, which should not change over time, and does not change from user input. This name should be used by code to reference a particular sheet.

Returns:

  • (String)


54
55
56
# File 'lib/axlsx/workbook/worksheet/sheet_pr.rb', line 54

def sync_ref
  @sync_ref
end

#worksheetWorksheet (readonly)

The worksheet these properties apply to!

Returns:



58
59
60
# File 'lib/axlsx/workbook/worksheet/sheet_pr.rb', line 58

def worksheet
  @worksheet
end

Instance Method Details

#page_setup_prPageSetUpPr

The PageSetUpPr for this sheet pr object

Returns:



84
85
86
# File 'lib/axlsx/workbook/worksheet/sheet_pr.rb', line 84

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)


75
76
77
78
79
80
# File 'lib/axlsx/workbook/worksheet/sheet_pr.rb', line 75

def to_xml_string(str = '')
  update_properties
  str << "<sheetPr #{serialized_attributes}>"
  page_setup_pr.to_xml_string(str)
  str << "</sheetPr>"
end