summaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
authorStefan Daschek <[email protected]>2012-05-15 18:15:47 +0200
committerStefan Daschek <[email protected]>2012-05-15 18:15:47 +0200
commit9237511af7a89dca97b4583bba41cd15317f25ec (patch)
tree286b75ed5a931d6716813f9d44e89117960d3125 /lib
parentdfc4f57d3153c4d7c8800cfd9f59df9b31dcdf93 (diff)
downloadcaxlsx-9237511af7a89dca97b4583bba41cd15317f25ec.tar.gz
caxlsx-9237511af7a89dca97b4583bba41cd15317f25ec.zip
Doc fixes for PrintOptions, PageSetup and Worksheet#fit_to_page.
Diffstat (limited to 'lib')
-rw-r--r--lib/axlsx/workbook/worksheet/page_setup.rb5
-rw-r--r--lib/axlsx/workbook/worksheet/worksheet.rb15
2 files changed, 13 insertions, 7 deletions
diff --git a/lib/axlsx/workbook/worksheet/page_setup.rb b/lib/axlsx/workbook/worksheet/page_setup.rb
index 93ba0dd4..f8441570 100644
--- a/lib/axlsx/workbook/worksheet/page_setup.rb
+++ b/lib/axlsx/workbook/worksheet/page_setup.rb
@@ -1,6 +1,9 @@
module Axlsx
# Page setup settings for printing a worksheet. All settings are optional.
#
+ # When using {#fit_to_width} and/or {#fit_to_height}, make sure to also set {Worksheet#fit_to_page} to true –
+ # otherwise this setting will not have any effect.
+ #
# @note The recommended way to manage print options is via Worksheet#page_setup
# @see Worksheet#print_options
# @see Worksheet#initialize
@@ -23,10 +26,12 @@ module Axlsx
# Number of vertical pages to fit on.
# @return [Integer]
+ # @note Make sure to also set {Worksheet#fit_to_page} to true – otherwise this setting will not have any effect.
attr_reader :fit_to_height
# Number of horizontal pages to fit on.
# @return [Integer]
+ # @note Make sure to also set {Worksheet#fit_to_page} to true – otherwise this setting will not have any effect.
attr_reader :fit_to_width
# Orientation of the page (:default, :landscape, :portrait)
diff --git a/lib/axlsx/workbook/worksheet/worksheet.rb b/lib/axlsx/workbook/worksheet/worksheet.rb
index 66d4b67c..2205b97d 100644
--- a/lib/axlsx/workbook/worksheet/worksheet.rb
+++ b/lib/axlsx/workbook/worksheet/worksheet.rb
@@ -51,8 +51,9 @@ module Axlsx
# @return Boolean
attr_reader :selected
- # Indicates if the worksheet should print in a single page
+ # Indicates if the worksheet should be fitted to a single page when printed. If you want the worksheet to fit on more pages (e.g. 2x2), set {PageSetup#fit_to_width} and {PageSetup#fit_to_height} accordingly.
# @return Boolean
+ # @see #page_setup
attr_reader :fit_to_page
@@ -88,7 +89,8 @@ module Axlsx
# wb = Axlsx::Package.new.workbook
#
# # using options when creating the worksheet.
- # ws = wb.add_worksheet :page_setup => {:fit_to_width => 1, :orientation => :landscape}
+ # ws = wb.add_worksheet :page_setup => {:fit_to_width => 2, :orientation => :landscape}
+ # ws.fit_to_page = true # otherwise fit_to_width will be ignored
#
# # use the set method of the page_setup object
# ws.page_setup.set(:paper_width => "297mm", :paper_height => "210mm")
@@ -110,15 +112,15 @@ module Axlsx
# @example
# wb = Axlsx::Package.new.workbook
# # using options when creating the worksheet.
- # ws = wb.add_worksheet :print_options => {:gridLines => true, :horizontalCentered => true}
+ # ws = wb.add_worksheet :print_options => {:grid_lines => true, :horizontal_centered => true}
#
# # use the set method of the page_margins object
# ws.print_options.set(:headings => true)
#
# # set page margins in a block
# ws.print_options do |options|
- # options.horizontalCentered = true
- # options.verticalCentered = true
+ # options.horizontal_centered = true
+ # options.vertical_centered = true
# end
# @see PrintOptions#initialize
# @return [PrintOptions]
@@ -233,8 +235,7 @@ module Axlsx
end
- # Indicates if the worksheet should print in a single page.
- # This is true by default.
+ # (see #fit_to_page)
# @return [Boolean]
def fit_to_page=(v)
Axlsx::validate_boolean v