Class: Axlsx::PageSetup
- Inherits:
-
Object
- Object
- Axlsx::PageSetup
- Defined in:
- lib/axlsx/workbook/worksheet/page_setup.rb
Overview
The recommended way to manage print options is via Worksheet#page_setup
Page setup settings for printing a worksheet. All settings are optional.
Instance Attribute Summary collapse
-
#fit_to_height ⇒ Integer
Number of vertical pages to fit on.
-
#fit_to_width ⇒ Integer
Number of horizontal pages to fit on.
-
#orientation ⇒ Symbol
Orientation of the page (:default, :landscape, :portrait).
-
#paper_height ⇒ String
Height of paper (string containing a number followed by a unit identifier: “297mm”, “11in”).
-
#paper_width ⇒ String
Width of paper (string containing a number followed by a unit identifier: “210mm”, “8.5in”).
-
#scale ⇒ Integer
Print scaling (percent value, given as integer ranging from 10 to 400).
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ PageSetup
constructor
Creates a new PageSetup object.
-
#set(options) ⇒ Object
Set some or all page settings at once.
-
#to_xml_string(str = '') ⇒ String
Serializes the page settings element.
Constructor Details
#initialize(options = {}) ⇒ PageSetup
Creates a new PageSetup object
56 57 58 |
# File 'lib/axlsx/workbook/worksheet/page_setup.rb', line 56 def initialize( = {}) set() end |
Instance Attribute Details
#fit_to_height ⇒ Integer
Number of vertical pages to fit on.
26 27 28 |
# File 'lib/axlsx/workbook/worksheet/page_setup.rb', line 26 def fit_to_height @fit_to_height end |
#fit_to_width ⇒ Integer
Number of horizontal pages to fit on.
30 31 32 |
# File 'lib/axlsx/workbook/worksheet/page_setup.rb', line 30 def fit_to_width @fit_to_width end |
#orientation ⇒ Symbol
Orientation of the page (:default, :landscape, :portrait)
34 35 36 |
# File 'lib/axlsx/workbook/worksheet/page_setup.rb', line 34 def orientation @orientation end |
#paper_height ⇒ String
Height of paper (string containing a number followed by a unit identifier: “297mm”, “11in”)
38 39 40 |
# File 'lib/axlsx/workbook/worksheet/page_setup.rb', line 38 def paper_height @paper_height end |
#paper_width ⇒ String
Width of paper (string containing a number followed by a unit identifier: “210mm”, “8.5in”)
42 43 44 |
# File 'lib/axlsx/workbook/worksheet/page_setup.rb', line 42 def paper_width @paper_width end |
#scale ⇒ Integer
Print scaling (percent value, given as integer ranging from 10 to 400)
46 47 48 |
# File 'lib/axlsx/workbook/worksheet/page_setup.rb', line 46 def scale @scale end |
Instance Method Details
#set(options) ⇒ Object
Set some or all page settings at once.
62 63 64 65 66 |
# File 'lib/axlsx/workbook/worksheet/page_setup.rb', line 62 def set() .each do |k, v| send("#{k}=", v) if respond_to? "#{k}=" end end |
#to_xml_string(str = '') ⇒ String
Serializes the page settings element.
84 85 86 87 88 |
# File 'lib/axlsx/workbook/worksheet/page_setup.rb', line 84 def to_xml_string(str = '') str << '<pageSetup ' str << instance_values.map{ |k,v| k.gsub(/_(.)/){ $1.upcase } << %{="#{v}"} }.join(' ') str << '/>' end |