summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--lib/axlsx/util/constants.rb2
-rw-r--r--lib/axlsx/version.rb4
-rw-r--r--lib/axlsx/workbook/worksheet/auto_filter/filters.rb20
-rw-r--r--lib/axlsx/workbook/worksheet/sheet_pr.rb2
-rw-r--r--lib/axlsx/workbook/worksheet/table_style_info.rb3
-rw-r--r--lib/axlsx/workbook/worksheet/worksheet.rb5
6 files changed, 33 insertions, 3 deletions
diff --git a/lib/axlsx/util/constants.rb b/lib/axlsx/util/constants.rb
index b1139133..66434b87 100644
--- a/lib/axlsx/util/constants.rb
+++ b/lib/axlsx/util/constants.rb
@@ -365,6 +365,8 @@ module Axlsx
# @see http://www.codetable.net/asciikeycodes
pattern = "[\x0-\x08\x0B\x0C\x0E-\x1F]"
pattern= pattern.respond_to?(:encode) ? pattern.encode('UTF-8') : pattern
+
+ # The regular expression used to remove control characters from worksheets
CONTROL_CHAR_REGEX = Regexp.new(pattern, 'n')
end
diff --git a/lib/axlsx/version.rb b/lib/axlsx/version.rb
index b32efc77..9a40f3f1 100644
--- a/lib/axlsx/version.rb
+++ b/lib/axlsx/version.rb
@@ -1,5 +1,5 @@
-# encoding: UTF-8
module Axlsx
+
# The current version
- VERSION="1.3.1"
+ VERSION = "1.3.1"
end
diff --git a/lib/axlsx/workbook/worksheet/auto_filter/filters.rb b/lib/axlsx/workbook/worksheet/auto_filter/filters.rb
index 49d8fce8..76ccf0de 100644
--- a/lib/axlsx/workbook/worksheet/auto_filter/filters.rb
+++ b/lib/axlsx/workbook/worksheet/auto_filter/filters.rb
@@ -64,6 +64,8 @@ module Axlsx
@calendar_type = calendar
end
+ # Set the value for blank
+ # @see blank
def blank=(use_blank)
Axlsx.validate_boolean use_blank
@blank = use_blank
@@ -87,6 +89,10 @@ module Axlsx
end
end
+ # Date group items are date group filter items where you specify the
+ # date_group and a value for that option as part of the auto_filter
+ # @note This can be specified, but will not be applied to the date
+ # values in your workbook at this time.
def date_group_items=(options)
options.each do |date_group|
raise ArgumentError, "date_group_items should be an array of hashes specifying the options for each date_group_item" unless date_group.is_a?(Hash)
@@ -104,6 +110,7 @@ module Axlsx
end
str
end
+
# This class expresses a filter criteria value.
class Filter
@@ -134,8 +141,20 @@ module Axlsx
# types, can be correctly compared for the purposes of filtering.
class DateGroupItem
+ # Allowed date time groupings
DATE_TIME_GROUPING = %w(year month day hour minute second)
+ # Creates a new DateGroupItem
+ # @param [Hash] options A hash of options to use when
+ # instanciating the object
+ # @option [String] date_time_grouping the part of the date this
+ # filter should apply for grouping
+ # @option [Integer|String] year @see year
+ # @option [Integer] month @see month
+ # @option [Integer] day @see day
+ # @option [Integer] hour @see hour
+ # @option [Integer] minute @see minute
+ # @option [Integer] second @see second
def initialize(options={})
raise ArgumentError, "You must specify a year for date time grouping" unless options[:year]
raise ArgumentError, "You must specify a date_time_grouping when creating a DateGroupItem for auto filter" unless options[:date_time_grouping]
@@ -216,6 +235,7 @@ module Axlsx
@second = value
end
+ # The date time grouping for this filter.
def date_time_grouping=(grouping)
RestrictionValidator.validate 'DateGroupItem.date_time_grouping', DATE_TIME_GROUPING, grouping.to_s
@date_time_grouping = grouping.to_s
diff --git a/lib/axlsx/workbook/worksheet/sheet_pr.rb b/lib/axlsx/workbook/worksheet/sheet_pr.rb
index 337d7272..d36b3a43 100644
--- a/lib/axlsx/workbook/worksheet/sheet_pr.rb
+++ b/lib/axlsx/workbook/worksheet/sheet_pr.rb
@@ -79,6 +79,8 @@ module Axlsx
str << "</sheetPr>"
end
+ # The PageSetUpPr for this sheet pr object
+ # @return [PageSetUpPr]
def page_setup_pr
@page_setup_pr ||= PageSetUpPr.new
end
diff --git a/lib/axlsx/workbook/worksheet/table_style_info.rb b/lib/axlsx/workbook/worksheet/table_style_info.rb
index 778546e0..0f39f0df 100644
--- a/lib/axlsx/workbook/worksheet/table_style_info.rb
+++ b/lib/axlsx/workbook/worksheet/table_style_info.rb
@@ -4,6 +4,7 @@ module Axlsx
# a worksheet
class TableStyleInfo
+ # boolean attributes for this object
BOOLEAN_ATTRIBUTES = %w(show_first_column show_last_column show_row_stripes show_column_stripes)
# creates a new TableStyleInfo instance
@@ -54,6 +55,8 @@ module Axlsx
# The name of the table style.
attr_accessor :name
+ # seralizes this object to an xml string
+ # @param [String] str the string to contact this objects serialization to.
def to_xml_string(str = '')
str << '<tableStyleInfo '
instance_values.each do |key, value|
diff --git a/lib/axlsx/workbook/worksheet/worksheet.rb b/lib/axlsx/workbook/worksheet/worksheet.rb
index 30d5c09c..02b0d049 100644
--- a/lib/axlsx/workbook/worksheet/worksheet.rb
+++ b/lib/axlsx/workbook/worksheet/worksheet.rb
@@ -42,10 +42,13 @@ module Axlsx
def name
@name ||= "Sheet" + (index+1).to_s
end
-
+
+ # The sheet calculation properties
+ # @return [SheetCalcPr]
def sheet_calc_pr
@sheet_calc_pr ||= SheetCalcPr.new
end
+
# The sheet protection object for this workbook
# @return [SheetProtection]
# @see SheetProtection