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. Only fit_to_page is implemented

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(worksheet) ⇒ SheetPr

Creates a new SheetPr object

Parameters:

  • worksheet (Worksheet)

    The worksheet that owns this SheetPr object

Raises:

  • (ArgumentError)


9
10
11
12
# File 'lib/axlsx/workbook/worksheet/sheet_pr.rb', line 9

def initialize(worksheet)
  raise ArgumentError, "you must provide a worksheet" unless worksheet.is_a?(Worksheet)
  @worksheet = worksheet
end

Instance Attribute Details

#worksheetObject (readonly)

Returns the value of attribute worksheet.



14
15
16
# File 'lib/axlsx/workbook/worksheet/sheet_pr.rb', line 14

def worksheet
  @worksheet
end

Instance Method Details

#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)


19
20
21
22
# File 'lib/axlsx/workbook/worksheet/sheet_pr.rb', line 19

def to_xml_string(str = '')
   return unless worksheet.fit_to_page?
  str << "<sheetPr><pageSetUpPr fitToPage=\"%s\"></pageSetUpPr></sheetPr>" % worksheet.fit_to_page?
end