summaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
authorRandy Morgan <[email protected]>2012-06-11 09:07:38 +0900
committerRandy Morgan <[email protected]>2012-06-11 09:07:38 +0900
commitcf40e93be91f535a630c038dd3620a72dea6c751 (patch)
treea5f84a4dc842db730e84d98e268577fbbcc7ef5b /lib
parent68f0b530e2260ceacf2ed916e216eaec5da60945 (diff)
downloadcaxlsx-cf40e93be91f535a630c038dd3620a72dea6c751.tar.gz
caxlsx-cf40e93be91f535a630c038dd3620a72dea6c751.zip
documentation improvements.
Diffstat (limited to 'lib')
-rw-r--r--lib/axlsx/package.rb14
-rw-r--r--lib/axlsx/workbook/workbook.rb6
-rw-r--r--lib/axlsx/workbook/worksheet/pane.rb12
-rw-r--r--lib/axlsx/workbook/worksheet/selection.rb10
-rw-r--r--lib/axlsx/workbook/worksheet/sheet_view.rb42
5 files changed, 45 insertions, 39 deletions
diff --git a/lib/axlsx/package.rb b/lib/axlsx/package.rb
index 34249ce4..d03a1738 100644
--- a/lib/axlsx/package.rb
+++ b/lib/axlsx/package.rb
@@ -80,9 +80,8 @@ module Axlsx
# Serialize your workbook to disk as an xlsx document.
#
- # @param [File] output The file you want to serialize your package to
+ # @param [String] output The name of the file you want to serialize your package to
# @param [Boolean] confirm_valid Validate the package prior to serialization.
- # @option options stream indicates if we should be writing to a stream or a file. True for stream, nil for file
# @return [Boolean] False if confirm_valid and validation errors exist. True if the package was serialized
# @note A tremendous amount of effort has gone into ensuring that you cannot create invalid xlsx documents.
# confirm_valid should be used in the rare case that you cannot open the serialized file.
@@ -90,10 +89,15 @@ module Axlsx
# @example
# # This is how easy it is to create a valid xlsx file. Of course you might want to add a sheet or two, and maybe some data, styles and charts.
# # Take a look at the README for an example of how to do it!
- # f = File.open('test.xlsx', 'w')
- # Package.new.serialize(f)
#
- # # You will find a file called test.xlsx
+ # #serialize to a file
+ # p = Axlsx::Package.new
+ # # ......add cool stuff to your workbook......
+ # p.serialize("example.xlsx")
+ #
+ # # Serialize to a stream
+ # s = p.to_stream()
+ # File.open('example_streamed.xlsx', 'w') { |f| f.write(s.read) }
def serialize(output, confirm_valid=false)
return false unless !confirm_valid || self.validate.empty?
Zip::ZipOutputStream.open(output) do |zip|
diff --git a/lib/axlsx/workbook/workbook.rb b/lib/axlsx/workbook/workbook.rb
index d53a0b44..08cbbc20 100644
--- a/lib/axlsx/workbook/workbook.rb
+++ b/lib/axlsx/workbook/workbook.rb
@@ -171,12 +171,14 @@ require 'axlsx/workbook/worksheet/selection.rb'
def self.date1904() @@date1904; end
# Indicates if the workbook should use autowidths or not.
- # this must be set before instantiating a worksheet to avoid Rmagix inclusion
+ # @note This gem no longer depends on RMagick for autowidth
+ # calculation. Thus the performance benefits of turning this off are
+ # marginal unless you are creating a very large sheet.
# @return [Boolean]
def use_autowidth() @use_autowidth; end
# see @use_autowidth
- def use_autowidth=(v) Axlsx::validate_boolean v; @use_autowidth = v; end
+ def use_autowidth=(v=true) Axlsx::validate_boolean v; @use_autowidth = v; end
# Adds a worksheet to this workbook
# @return [Worksheet]
diff --git a/lib/axlsx/workbook/worksheet/pane.rb b/lib/axlsx/workbook/worksheet/pane.rb
index 8403c9ec..069d5dd7 100644
--- a/lib/axlsx/workbook/worksheet/pane.rb
+++ b/lib/axlsx/workbook/worksheet/pane.rb
@@ -30,7 +30,7 @@ module Axlsx
# specifies the right pane.
# @see type
# @return [Symbol]
- # @default nil
+ # default nil
attr_reader :active_pane
@@ -49,7 +49,7 @@ module Axlsx
# bars are adjustable by the user.
# @see type
# @return [Symbol]
- # @default nil
+ # default nil
attr_reader :state
@@ -58,7 +58,7 @@ module Axlsx
# right pane (when in Left-To-Right mode).
# @see type
# @return [String]
- # @default nil
+ # default nil
attr_reader :top_left_cell
@@ -68,7 +68,7 @@ module Axlsx
# of columns visible in the top pane.
# @see type
# @return [Integer]
- # @default 0
+ # default 0
attr_reader :x_split
@@ -78,7 +78,7 @@ module Axlsx
# of rows visible in the left pane.
# @see type
# @return [Integer]
- # @default 0
+ # default 0
attr_reader :y_split
@@ -141,4 +141,4 @@ module Axlsx
str << '/>'
end
end
-end \ No newline at end of file
+end
diff --git a/lib/axlsx/workbook/worksheet/selection.rb b/lib/axlsx/workbook/worksheet/selection.rb
index 6674c55d..b1ada495 100644
--- a/lib/axlsx/workbook/worksheet/selection.rb
+++ b/lib/axlsx/workbook/worksheet/selection.rb
@@ -10,7 +10,7 @@ module Axlsx
# Location of the active cell.
# @see type
# @return [String]
- # @default nil
+ # default nil
attr_reader :active_cell
@@ -22,7 +22,7 @@ module Axlsx
# When this value is out of range then activeCell can be used.
# @see type
# @return [Integer]
- # @default nil
+ # default nil
attr_reader :active_cell_id
@@ -50,7 +50,7 @@ module Axlsx
# specifies the right pane.
# @see type
# @return [Symbol]
- # @default nil
+ # default nil
attr_reader :pane
@@ -58,7 +58,7 @@ module Axlsx
# Range of the selection. Can be non-contiguous set of ranges.
# @see type
# @return [String]
- # @default nil
+ # default nil
attr_reader :sqref
@@ -108,4 +108,4 @@ module Axlsx
str << '/>'
end
end
-end \ No newline at end of file
+end
diff --git a/lib/axlsx/workbook/worksheet/sheet_view.rb b/lib/axlsx/workbook/worksheet/sheet_view.rb
index 12b74b6a..fc07bacb 100644
--- a/lib/axlsx/workbook/worksheet/sheet_view.rb
+++ b/lib/axlsx/workbook/worksheet/sheet_view.rb
@@ -30,7 +30,7 @@ module Axlsx
# rgb value.
# @see type
# @return [Integer]
- # @default nil
+ # default nil
attr_reader :color_id
@@ -41,7 +41,7 @@ module Axlsx
# specified in colorId.
# @see type
# @return [Boolean]
- # @default true
+ # default true
attr_reader :default_grid_color
@@ -54,7 +54,7 @@ module Axlsx
# to Left format.
# @see type
# @return [Boolean]
- # @default false
+ # default false
attr_reader :right_to_left
@@ -63,7 +63,7 @@ module Axlsx
# display formulas.
# @see type
# @return [Boolean]
- # @default false
+ # default false
attr_reader :show_formulas
@@ -72,7 +72,7 @@ module Axlsx
# should display gridlines.
# @see type
# @return [Boolean]
- # @default true
+ # default true
attr_reader :show_grid_lines
@@ -84,7 +84,7 @@ module Axlsx
# when there is a conflict.
# @see type
# @return [Boolean]
- # @default false
+ # default false
attr_reader :show_outline_symbols
@@ -93,7 +93,7 @@ module Axlsx
# display row and column headings.
# @see type
# @return [Boolean]
- # @default true
+ # default true
attr_reader :show_row_col_headers
@@ -101,7 +101,7 @@ module Axlsx
# Show the ruler in Page Layout View.
# @see type
# @return [Boolean]
- # @default true
+ # default true
attr_reader :show_ruler
@@ -113,7 +113,7 @@ module Axlsx
# there is data in the header or footer).
# @see type
# @return [Boolean]
- # @default false
+ # default false
attr_reader :show_white_space
@@ -124,7 +124,7 @@ module Axlsx
# blank instead of showing the number zero.
# @see type
# @return [Boolean]
- # @default true
+ # default true
attr_reader :show_zeros
@@ -138,7 +138,7 @@ module Axlsx
# be active at one time.
# @see type
# @return [Boolean]
- # @default false
+ # default false
attr_reader :tab_selected
@@ -148,7 +148,7 @@ module Axlsx
# pane (when in Left-to-Right mode).
# @see type
# @return [String]
- # @default nil
+ # default nil
attr_reader :top_left_cell
@@ -160,7 +160,7 @@ module Axlsx
# * page_layout: Page Layout View
# @see type
# @return [Symbol]
- # @default :normal
+ # default :normal
attr_reader :view
@@ -171,7 +171,7 @@ module Axlsx
# protected.
# @see type
# @return [Boolean]
- # @default true
+ # default true
attr_reader :window_protection
@@ -180,7 +180,7 @@ module Axlsx
# to a workbookView element in the bookViews collection.
# @see type
# @return [Integer]
- # @default 0
+ # default 0
attr_reader :workbook_view_id
@@ -193,7 +193,7 @@ module Axlsx
# Page Break Preview.
# @see type
# @return [Integer]
- # @default 100
+ # default 100
attr_reader :zoom_scale
@@ -206,7 +206,7 @@ module Axlsx
# automatic setting.
# @see type
# @return [Integer]
- # @default 0
+ # default 0
attr_reader :zoom_scale_normal
@@ -219,7 +219,7 @@ module Axlsx
# the automatic setting.
# @see type
# @return [Integer]
- # @default 0
+ # default 0
attr_reader :zoom_scale_page_layout_view
@@ -233,7 +233,7 @@ module Axlsx
# the automatic setting.
# @see type
# @return [Integer]
- # @default 0
+ # default 0
attr_reader :zoom_scale_sheet_layout_view
@@ -260,7 +260,7 @@ module Axlsx
#defaults
@color_id = @top_left_cell = @pane = nil
@right_to_left = @show_formulas = @show_outline_symbols = @show_white_space = @tab_selected = @window_protection = false
- @default_grid_color = @show_grid_lines = @show_row_col_headers = @show_ruler = @show_zeros = true
+ default_grid_color = @show_grid_lines = @show_row_col_headers = @show_ruler = @show_zeros = true
@zoom_scale = 100
@zoom_scale_normal = @zoom_scale_page_layout_view = @zoom_scale_sheet_layout_view = @workbook_view_id = 0
@selections = {}
@@ -285,7 +285,7 @@ module Axlsx
# @see default_grid_color
- def default_grid_color=(v); Axlsx::validate_boolean(v); @default_grid_color = v end
+ def default_grid_color=(v); Axlsx::validate_boolean(v); default_grid_color = v end
# @see right_to_left