summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRandy Morgan <[email protected]>2012-05-30 20:22:41 +0900
committerRandy Morgan <[email protected]>2012-05-30 20:22:41 +0900
commit3e9026bae0dde81eeeb86ee76ee680b4b8878b86 (patch)
tree2801d2282c6e3f663ecaa307c062b84662d8a8ce
parentf7287c1f421a7e71ae34658adb29b30fefb1afe3 (diff)
downloadcaxlsx-3e9026bae0dde81eeeb86ee76ee680b4b8878b86.tar.gz
caxlsx-3e9026bae0dde81eeeb86ee76ee680b4b8878b86.zip
release prep for 1.1.6
-rw-r--r--README.md23
-rw-r--r--lib/axlsx.rb3
-rw-r--r--lib/axlsx/version.rb2
-rw-r--r--lib/axlsx/workbook/worksheet/data_validation.rb30
-rw-r--r--lib/axlsx/workbook/worksheet/sheet_protection.rb34
-rw-r--r--lib/axlsx/workbook/worksheet/worksheet.rb8
-rw-r--r--test/workbook/worksheet/tc_data_validation.rb8
7 files changed, 66 insertions, 42 deletions
diff --git a/README.md b/README.md
index 58e83aa1..e0fe68c6 100644
--- a/README.md
+++ b/README.md
@@ -16,7 +16,7 @@ Axlsx: Office Open XML Spreadsheet Generation
**License**: MIT License
-**Latest Version**: 1.1.5
+**Latest Version**: 1.1.6
**Ruby Version**: 1.8.7, 1.9.2, 1.9.3
@@ -24,7 +24,7 @@ Axlsx: Office Open XML Spreadsheet Generation
**Rubinius Version**: rubinius 2.0.0dev * lower versions may run, this gem always tests against head.
-**Release Date**: May 13rd 2012
+**Release Date**: May 30th 2012
If you are working in rails, or with active record see:
http://github.com/randym/acts_as_xlsx
@@ -32,6 +32,9 @@ http://github.com/randym/acts_as_xlsx
There are guides for using axlsx and acts_as_xlsx here:
[http://axlsx.blogspot.com](http://axlsx.blogspot.com)
+The examples directory contains a number of more specific examples as
+well.
+
Synopsis
--------
@@ -63,7 +66,8 @@ Feature List
**9. Cell level style overrides for default and customized style objects
-**10. Support for formulas
+**10. Support for formulas, merging, row and column outlining as well as
+cell level input data validation.
**11. Support for cell merging as well as column and row outline
@@ -107,6 +111,17 @@ This gem has 100% test coverage using test/unit. To execute tests for this gem,
#Change log
---------
+- ** May.30.12**: 1.1.6 release
+ - data protection with passwords for sheets
+ - cell level input validators
+ - added support for two cell anchors for images
+ - test coverage now back up to 100%
+ - bugfix for merge cell sorting algorithm
+ - added fit_to method for page_setup to simplify managing witdh/height
+ - added ph (phonetics) and s (style) attributes for row.
+ - resolved all warnings generating from this gem.
+ - improved comment relationship management for multiple comments
+
- ** May.13.12**: 1.1.5 release
- MOAR print options! You can now specify paper size, orientation,
fit to width, page margings and gridlines for printing.
@@ -159,6 +174,8 @@ Please see the {file:CHANGELOG.md} document for past release information.
[scpike](https://github.com/scpike) - for keeping numbers fixed even when they are rational and a super clean implementation of conditional formatting.
+[janhuehne](https://github.com/janhuehne) - for working out the decoder ring and adding in cell level validation.
+
#Copyright and License
----------
diff --git a/lib/axlsx.rb b/lib/axlsx.rb
index 7faabf3e..92c58b33 100644
--- a/lib/axlsx.rb
+++ b/lib/axlsx.rb
@@ -84,6 +84,9 @@ module Axlsx
Axlsx::col_ref(c_index).to_s << (r_index+1).to_s
end
+ # performs the increadible feat of changing snake_case to CamelCase
+ # @param [String] s The snake case string to camelize
+ # @return [String]
def self.camel(s="")
s = s.capitalize.gsub(/_(.)/){ $1.upcase }
end
diff --git a/lib/axlsx/version.rb b/lib/axlsx/version.rb
index 740038de..44727f85 100644
--- a/lib/axlsx/version.rb
+++ b/lib/axlsx/version.rb
@@ -5,6 +5,6 @@ module Axlsx
# When using bunle exec rake and referencing the gem on github or locally
# it will use the gemspec, which preloads this constant for the gem's version.
# We check to make sure that it has not already been loaded
- VERSION="1.1.5" unless defined? Axlsx::VERSION
+ VERSION="1.1.6" unless defined? Axlsx::VERSION
end
diff --git a/lib/axlsx/workbook/worksheet/data_validation.rb b/lib/axlsx/workbook/worksheet/data_validation.rb
index 8eca9375..e790bc77 100644
--- a/lib/axlsx/workbook/worksheet/data_validation.rb
+++ b/lib/axlsx/workbook/worksheet/data_validation.rb
@@ -13,14 +13,14 @@ module Axlsx
# Available for type whole, decimal, date, time, textLength, list, custom
# @see type
# @return [String]
- # @default nil
+ # default nil
attr_reader :formula1
# Formula2
# Available for type whole, decimal, date, time, textLength
# @see type
# @return [String]
- # @default nil
+ # default nil
attr_reader :formula2
# Allow Blank
@@ -29,7 +29,7 @@ module Axlsx
# Available for type whole, decimal, date, time, textLength, list, custom
# @see type
# @return [Boolean]
- # @default true
+ # default true
attr_reader :allowBlank
# Error Message
@@ -37,7 +37,7 @@ module Axlsx
# Available for type whole, decimal, date, time, textLength, list, custom
# @see type
# @return [String]
- # @default nil
+ # default nil
attr_reader :error
# Error Style (ST_DataValidationErrorStyle)
@@ -49,7 +49,7 @@ module Axlsx
# Available for type whole, decimal, date, time, textLength, list, custom
# @see type
# @return [Symbol]
- # @default :stop
+ # default :stop
attr_reader :errorStyle
# Error Title
@@ -57,7 +57,7 @@ module Axlsx
# Available for type whole, decimal, date, time, textLength, list, custom
# @see type
# @return [String]
- # @default nil
+ # default nil
attr_reader :errorTitle
# Operator (ST_DataValidationOperator)
@@ -74,7 +74,7 @@ module Axlsx
# Available for type whole, decimal, date, time, textLength
# @see type
# @return [Symbol]
- # @default nil
+ # default nil
attr_reader :operator
# Input prompt
@@ -82,7 +82,7 @@ module Axlsx
# Available for type whole, decimal, date, time, textLength, list, custom
# @see type
# @return [String]
- # @default nil
+ # default nil
attr_reader :prompt
# Prompt title
@@ -90,7 +90,7 @@ module Axlsx
# Available for type whole, decimal, date, time, textLength, list, custom
# @see type
# @return [String]
- # @default nil
+ # default nil
attr_reader :promptTitle
# Show drop down
@@ -99,7 +99,7 @@ module Axlsx
# Available for type list
# @see type
# @return [Boolean]
- # @default false
+ # default false
attr_reader :showDropDown
# Show error message
@@ -108,7 +108,7 @@ module Axlsx
# Available for type whole, decimal, date, time, textLength, list, custom
# @see type
# @return [Boolean]
- # @default false
+ # default false
attr_reader :showErrorMessage
# Show input message
@@ -116,14 +116,14 @@ module Axlsx
# Available for type whole, decimal, date, time, textLength, list, custom
# @see type
# @return [Boolean]
- # @default false
+ # default false
attr_reader :showInputMessage
# Range over which data validation is applied, in "A1:B2" format
# Available for type whole, decimal, date, time, textLength, list, custom
# @see type
# @return [String]
- # @default nil
+ # default nil
attr_reader :sqref
# The type (ST_DataValidationType) of data validation.
@@ -137,7 +137,7 @@ module Axlsx
# * time: Data validation which checks for time values satisfying the given condition.
# * whole: Data validation which checks for whole number values satisfying the given condition.
# @return [Symbol]
- # @default none
+ # default none
attr_reader :type
# Creates a new {DataValidation} object
@@ -242,4 +242,4 @@ module Axlsx
attributes.flatten!
end
end
-end \ No newline at end of file
+end
diff --git a/lib/axlsx/workbook/worksheet/sheet_protection.rb b/lib/axlsx/workbook/worksheet/sheet_protection.rb
index d8855008..104be53b 100644
--- a/lib/axlsx/workbook/worksheet/sheet_protection.rb
+++ b/lib/axlsx/workbook/worksheet/sheet_protection.rb
@@ -7,67 +7,67 @@ module Axlsx
# If 1 or true then AutoFilters should not be allowed to operate when the sheet is protected.
# If 0 or false then AutoFilters should be allowed to operate when the sheet is protected.
# @return [Boolean]
- # @default true
+ # default true
attr_reader :auto_filter
# If 1 or true then deleting columns should not be allowed when the sheet is protected.
# If 0 or false then deleting columns should be allowed when the sheet is protected.
# @return [Boolean]
- # @default true
+ # default true
attr_reader :delete_columns
# If 1 or true then deleting rows should not be allowed when the sheet is protected.
# If 0 or false then deleting rows should be allowed when the sheet is protected.
# @return [Boolean]
- # @default true
+ # default true
attr_reader :delete_rows
# If 1 or true then formatting cells should not be allowed when the sheet is protected.
# If 0 or false then formatting cells should be allowed when the sheet is protected.
# @return [Boolean]
- # @default true
+ # default true
attr_reader :format_cells
# If 1 or true then formatting columns should not be allowed when the sheet is protected.
# If 0 or false then formatting columns should be allowed when the sheet is protected.
# @return [Boolean]
- # @default true
+ # default true
attr_reader :format_columns
# If 1 or true then formatting rows should not be allowed when the sheet is protected.
# If 0 or false then formatting rows should be allowed when the sheet is protected.
# @return [Boolean]
- # @default true
+ # default true
attr_reader :format_rows
# If 1 or true then inserting columns should not be allowed when the sheet is protected.
# If 0 or false then inserting columns should be allowed when the sheet is protected.
# @return [Boolean]
- # @default true
+ # default true
attr_reader :insert_columns
# If 1 or true then inserting hyperlinks should not be allowed when the sheet is protected.
# If 0 or false then inserting hyperlinks should be allowed when the sheet is protected.
# @return [Boolean]
- # @default true
+ # default true
attr_reader :insert_hyperlinks
# If 1 or true then inserting rows should not be allowed when the sheet is protected.
# If 0 or false then inserting rows should be allowed when the sheet is protected.
# @return [Boolean]
- # @default true
+ # default true
attr_reader :insert_rows
# If 1 or true then editing of objects should not be allowed when the sheet is protected.
# If 0 or false then objects are allowed to be edited when the sheet is protected.
# @return [Boolean]
- # @default false
+ # default false
attr_reader :objects
# If 1 or true then PivotTables should not be allowed to operate when the sheet is protected.
# If 0 or false then PivotTables should be allowed to operate when the sheet is protected.
# @return [Boolean]
- # @default true
+ # default true
attr_reader :pivot_tables
# Specifies the salt which was prepended to the user-supplied password before it was hashed using the hashing algorithm
@@ -77,36 +77,36 @@ module Axlsx
# If 1 or true then Scenarios should not be edited when the sheet is protected.
# If 0 or false then Scenarios are allowed to be edited when the sheet is protected.
# @return [Boolean]
- # @default false
+ # default false
attr_reader :scenarios
# If 1 or true then selection of locked cells should not be allowed when the sheet is protected.
# If 0 or false then selection of locked cells should be allowed when the sheet is protected.
# @return [Boolean]
- # @default false
+ # default false
attr_reader :select_locked_cells
# If 1 or true then selection of unlocked cells should not be allowed when the sheet is protected.
# If 0 or false then selection of unlocked cells should be allowed when the sheet is protected.
# @return [Boolean]
- # @default false
+ # default false
attr_reader :select_unlocked_cells
# If 1 or true then the sheet is protected.
# If 0 or false then the sheet is not protected.
# @return [Boolean]
- # @default true
+ # default true
attr_reader :sheet
# If 1 or true then sorting should not be allowed when the sheet is protected.
# If 0 or false then sorting should be allowed when the sheet is protected.
# @return [Boolean]
- # @default true
+ # default true
attr_reader :sort
# Password hash
# @return [String]
- # @default nil
+ # default nil
attr_reader :password
# Creates a new SheetProtection instance
diff --git a/lib/axlsx/workbook/worksheet/worksheet.rb b/lib/axlsx/workbook/worksheet/worksheet.rb
index 56c17f32..3f73ee19 100644
--- a/lib/axlsx/workbook/worksheet/worksheet.rb
+++ b/lib/axlsx/workbook/worksheet/worksheet.rb
@@ -206,11 +206,9 @@ module Axlsx
# Add data validation to this worksheet.
#
- # @param
- # @example
- #
- # @see
- # @see
+ # @param [String] cells The cells the validation will apply to.
+ # @param [hash] data_validation options defining the validation to apply.
+ # @see examples/data_validation.rb for an example
def add_data_validation(cells, data_validation)
dv = DataValidation.new(data_validation)
dv.sqref = cells
diff --git a/test/workbook/worksheet/tc_data_validation.rb b/test/workbook/worksheet/tc_data_validation.rb
index c30ce251..17622d7d 100644
--- a/test/workbook/worksheet/tc_data_validation.rb
+++ b/test/workbook/worksheet/tc_data_validation.rb
@@ -256,4 +256,10 @@ class TestDataValidation < Test::Unit::TestCase
[@promptTitle='Be carful!'][@prompt='Only values from list'][@errorTitle='Wrong input'][@error='Only values from list']
[@showErrorMessage='true'][@allowBlank='true'][@showInputMessage='true'][@showDropDown='true'][@type='list'][@errorStyle='stop']")
end
-end \ No newline at end of file
+
+ def test_empty_attributes
+ v = Axlsx::DataValidation.new
+ assert_equal(nil, v.send(:get_valid_attributes))
+
+ end
+end