summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRandy Morgan <[email protected]>2013-02-04 15:36:35 +0900
committerRandy Morgan <[email protected]>2013-02-04 15:36:35 +0900
commit61488b068f220a32f4c5ab50a4108e61caa4d7aa (patch)
tree8dcb574ca3e6f5819b349ebdc35628bf1b635f44
parent7d578aa6a4f54b88855e530a1a543c38387fe03d (diff)
downloadcaxlsx-61488b068f220a32f4c5ab50a4108e61caa4d7aa.tar.gz
caxlsx-61488b068f220a32f4c5ab50a4108e61caa4d7aa.zip
Completed missing docs and pre-release prep
-rw-r--r--README.md4
-rwxr-xr-xexamples/example.rb13
-rw-r--r--lib/axlsx/drawing/graphic_frame.rb4
-rw-r--r--lib/axlsx/util/constants.rb4
-rw-r--r--lib/axlsx/workbook/worksheet/pivot_table.rb26
-rw-r--r--lib/axlsx/workbook/worksheet/pivot_table_cache_definition.rb2
-rw-r--r--lib/axlsx/workbook/worksheet/sheet_format_pr.rb14
7 files changed, 39 insertions, 28 deletions
diff --git a/README.md b/README.md
index 705aef4c..5a3eec93 100644
--- a/README.md
+++ b/README.md
@@ -29,7 +29,7 @@ appreciation for the gem, please don't hesitate to make a donation.
**Rubinius Version**: rubinius 2.0.0dev * lower versions may run, this gem always tests against head.
-**Release Date**: November ??th 2012
+**Release Date**: February 4th 2013
If you are working in rails, or with active record see:
* http://github.com/randym/acts_as_xlsx
@@ -152,7 +152,7 @@ This gem has 100% test coverage using test/unit. To execute tests for this gem,
#Change log
---------
-- **January.??.12**:1.3.5
+- **February.4.13**:1.3.5
- converted vary_colors for chart data to instance variable with appropriate defulats for the various charts.
- Added trust_input method on Axlsx to instruct the serializer to skip HTML escaping. This will give you a tremendous performance boost,
Please be sure that you will never have <, >, etc in your content or the XML will be invalid.
diff --git a/examples/example.rb b/examples/example.rb
index 66e8f4dc..c9b5564e 100755
--- a/examples/example.rb
+++ b/examples/example.rb
@@ -237,9 +237,6 @@ if examples.include? :fixed_column_width
sheet.add_row ["I use autowidth and am very wide", "I use a custom width and am narrow"]
sheet.add_row ['abcdefg', 'This is a very long text and should flow into the right cell', nil, 'xxx' ]
sheet.column_widths nil, 3, 5, nil
- sheet.column_info.each do |col|
- puts col.width
- end
end
end
@@ -512,7 +509,7 @@ end
if examples.include? :fit_to_page
wb.add_worksheet(:name => "fit to page") do |sheet|
sheet.add_row ['this all goes on one page']
- sheet.fit_to_page = true
+ sheet.page_setup.fit_to :width => 1, :height => 1
end
end
##```
@@ -524,7 +521,7 @@ end
if examples.include? :hide_gridlines
wb.add_worksheet(:name => "No Gridlines") do |sheet|
sheet.add_row ["This", "Sheet", "Hides", "Gridlines"]
- sheet.show_gridlines = false
+ sheet.sheet_view.show_grid_lines = false
end
end
##```
@@ -726,11 +723,6 @@ if examples.include? :shared_strings
end
#```
-#p.validate do |er|
-#puts er.inspect
-#end
-##Disabling Autowidth
-
#```ruby
if examples.include? :no_autowidth
p = Axlsx::Package.new
@@ -750,7 +742,6 @@ if examples.include? :cached_formula
p.use_shared_strings = true
wb = p.workbook
wb.add_worksheet(:name => "cached formula") do | sheet |
- puts sheet.sheet_format_pr
sheet.add_row [1, 2, '=A1+B1'], :formula_values => [nil, nil, 3]
end
p.serialize 'cached_formula.xlsx'
diff --git a/lib/axlsx/drawing/graphic_frame.rb b/lib/axlsx/drawing/graphic_frame.rb
index 888cde76..943caeae 100644
--- a/lib/axlsx/drawing/graphic_frame.rb
+++ b/lib/axlsx/drawing/graphic_frame.rb
@@ -28,10 +28,6 @@ module Axlsx
# NOTE: Discontinued. This should not be part of GraphicFrame.
# The drawing object maintains relationships and needs to be queried to determine the relationship id of any given graphic data child object.
#
- # @example
- # <a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/chart">
- # <c:chart xmlns:c="http://schemas.openxmlformats.org/drawingml/2006/chart" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" r:id="rId2"/>
- # </a:graphicData>
def rId
warn('axlsx::DEPRECIATED: GraphicFrame#rId has been depreciated. relationship id is determed by the drawing object')
"rId#{@anchor.index+1}"
diff --git a/lib/axlsx/util/constants.rb b/lib/axlsx/util/constants.rb
index f9bffa87..d3e0ad5c 100644
--- a/lib/axlsx/util/constants.rb
+++ b/lib/axlsx/util/constants.rb
@@ -53,6 +53,8 @@ module Axlsx
# pivot table rels namespace
PIVOT_TABLE_R = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotTable"
+
+ # pivot table cache definition namespace
PIVOT_TABLE_CACHE_DEFINITION_R = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheDefinition"
# workbook rels namespace
@@ -220,6 +222,8 @@ module Axlsx
# pivot table parts
PIVOT_TABLE_PN = "pivotTables/pivotTable%d.xml"
+
+ # pivot table cache definition part name
PIVOT_TABLE_CACHE_DEFINITION_PN = "pivotCache/pivotCacheDefinition%d.xml"
# pivot table rels parts
diff --git a/lib/axlsx/workbook/worksheet/pivot_table.rb b/lib/axlsx/workbook/worksheet/pivot_table.rb
index d5a05db8..4ebcdee8 100644
--- a/lib/axlsx/workbook/worksheet/pivot_table.rb
+++ b/lib/axlsx/workbook/worksheet/pivot_table.rb
@@ -43,6 +43,7 @@ module Axlsx
# @return [String]
attr_reader :range
+ # (see #range)
def range=(v)
DataTypeValidator.validate "#{self.class}.range", [String], v
if v.is_a?(String)
@@ -54,6 +55,8 @@ module Axlsx
# @return [Array]
attr_reader :rows
+
+ # (see #rows)
def rows=(v)
DataTypeValidator.validate "#{self.class}.rows", [Array], v
v.each do |ref|
@@ -66,6 +69,7 @@ module Axlsx
# @return [Array]
attr_reader :columns
+ # (see #columns)
def columns=(v)
DataTypeValidator.validate "#{self.class}.columns", [Array], v
v.each do |ref|
@@ -78,6 +82,7 @@ module Axlsx
# @return [Array]
attr_reader :data
+ # (see #data)
def data=(v)
DataTypeValidator.validate "#{self.class}.data", [Array], v
v.each do |ref|
@@ -90,6 +95,7 @@ module Axlsx
# @return [String]
attr_reader :pages
+ # (see #pages)
def pages=(v)
DataTypeValidator.validate "#{self.class}.pages", [Array], v
v.each do |ref|
@@ -116,10 +122,8 @@ module Axlsx
"#{PIVOT_TABLE_RELS_PN % (index+1)}"
end
- def header_cells_count
- header_cells.count
- end
-
+ # The cache_definition for this pivot table
+ # @return [PivotTableCacheDefinition]
def cache_definition
@cache_definition ||= PivotTableCacheDefinition.new(self)
end
@@ -193,18 +197,32 @@ module Axlsx
str << '</pivotTableDefinition>'
end
+ # References for header cells
+ # @return [Array]
def header_cell_refs
Axlsx::range_to_a(header_range).first
end
+ # The header cells for the pivot table
+ # @return [Array]
def header_cells
@sheet[header_range]
end
+ # The values in the header cells collection
+ # @return [Array]
def header_cell_values
header_cells.map(&:value)
end
+ # The number of cells in the header_cells collection
+ # @return [Integer]
+ def header_cells_count
+ header_cells.count
+ end
+
+ # The index of a given value in the header cells
+ # @return [Integer]
def header_index_of(value)
header_cell_values.index(value)
end
diff --git a/lib/axlsx/workbook/worksheet/pivot_table_cache_definition.rb b/lib/axlsx/workbook/worksheet/pivot_table_cache_definition.rb
index 5a6c7442..c1683520 100644
--- a/lib/axlsx/workbook/worksheet/pivot_table_cache_definition.rb
+++ b/lib/axlsx/workbook/worksheet/pivot_table_cache_definition.rb
@@ -29,6 +29,8 @@ module Axlsx
"#{PIVOT_TABLE_CACHE_DEFINITION_PN % (index+1)}"
end
+ # The identifier for this cache
+ # @return [Integer]
def cache_id
index + 1
end
diff --git a/lib/axlsx/workbook/worksheet/sheet_format_pr.rb b/lib/axlsx/workbook/worksheet/sheet_format_pr.rb
index f6c9df55..fc9ce3a3 100644
--- a/lib/axlsx/workbook/worksheet/sheet_format_pr.rb
+++ b/lib/axlsx/workbook/worksheet/sheet_format_pr.rb
@@ -29,17 +29,11 @@ module Axlsx
# @option [Boolean] thick_bottom 'True' if rows have a thick bottom border by default.
# @option [Integer] outline_level_row Highest number of outline level for rows in this sheet. These values shall be in synch with the actual sheet outline levels.
# @option [Integer] outline_level_col Highest number of outline levels for columns in this sheet. These values shall be in synch with the actual sheet outline levels.
- #
def initialize(options={})
set_defaults
parse_options options
end
- def set_defaults
- @base_col_width = 8
- @default_row_height = 18
- end
-
serializable_attributes :base_col_width, :default_col_width, :default_row_height,
:custom_height, :zero_height, :thick_top, :thick_bottom,
:outline_level_row, :outline_level_col
@@ -51,10 +45,16 @@ module Axlsx
unsigned_int_attr_accessor :base_col_width, :outline_level_row, :outline_level_col
# serializes this object to an xml string
- # @param @str The string this objects serialization will be appended to
+ # @param [String] str The string this objects serialization will be appended to
# @return [String]
def to_xml_string(str='')
str << "<sheetFormatPr #{serialized_attributes}/>"
end
+
+ private
+ def set_defaults
+ @base_col_width = 8
+ @default_row_height = 18
+ end
end
end