summaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
authorNoel Peden <[email protected]>2019-12-18 16:52:58 -0800
committerNoel Peden <[email protected]>2019-12-18 16:52:58 -0800
commit4c8be196347802a75ff3f2eb54fb183103a88776 (patch)
tree24df50b911a44b55f7ed6667f407d456711908e5 /lib
parenta9ec6cb6140367b4ad08bb743f9a22200c481c70 (diff)
parent5cfccd88eba0f38d6576e44de7e0aa4c41f55f83 (diff)
downloadcaxlsx-4c8be196347802a75ff3f2eb54fb183103a88776.tar.gz
caxlsx-4c8be196347802a75ff3f2eb54fb183103a88776.zip
Merge branch 'master' of https://github.com/caxlsx/axlsx
Diffstat (limited to 'lib')
-rw-r--r--lib/axlsx.rb2
-rw-r--r--lib/axlsx/drawing/bar_chart.rb6
-rw-r--r--lib/axlsx/drawing/bar_series.rb8
-rw-r--r--lib/axlsx/package.rb10
-rw-r--r--lib/axlsx/util/parser.rb44
-rw-r--r--lib/axlsx/workbook/workbook.rb9
-rw-r--r--lib/axlsx/workbook/worksheet/cell.rb2
-rw-r--r--lib/axlsx/workbook/worksheet/worksheet.rb2
8 files changed, 9 insertions, 74 deletions
diff --git a/lib/axlsx.rb b/lib/axlsx.rb
index 23fc6c8b..e60660b6 100644
--- a/lib/axlsx.rb
+++ b/lib/axlsx.rb
@@ -9,8 +9,6 @@ require 'axlsx/util/validators.rb'
require 'axlsx/util/accessors.rb'
require 'axlsx/util/serialized_attributes'
require 'axlsx/util/options_parser'
-# to be included with parsable intitites.
-#require 'axlsx/util/parser.rb'
require 'axlsx/util/mime_type_utils'
require 'axlsx/stylesheet/styles.rb'
diff --git a/lib/axlsx/drawing/bar_chart.rb b/lib/axlsx/drawing/bar_chart.rb
index 7efd0ec5..e9af9400 100644
--- a/lib/axlsx/drawing/bar_chart.rb
+++ b/lib/axlsx/drawing/bar_chart.rb
@@ -1,7 +1,7 @@
# encoding: UTF-8
module Axlsx
- # The BarChart is a three dimentional barchart (who would have guessed?) that you can add to your worksheet.
+ # The BarChart is a two dimentional barchart that you can add to your worksheet.
# @see Worksheet#add_chart
# @see Chart#add_series
# @see Package#serialize
@@ -49,7 +49,7 @@ module Axlsx
@grouping ||= :clustered
end
- # The shabe of the bars or columns
+ # The shape of the bars or columns
# must be one of [:cone, :coneToMax, :box, :cylinder, :pyramid, :pyramidToMax]
# @return [Symbol]
def shape
@@ -106,7 +106,7 @@ module Axlsx
end
alias :gapDepth= :gap_depth=
- # The shabe of the bars or columns
+ # The shape of the bars or columns
# must be one of [:cone, :coneToMax, :box, :cylinder, :pyramid, :pyramidToMax]
def shape=(v)
RestrictionValidator.validate "BarChart.shape", [:cone, :coneToMax, :box, :cylinder, :pyramid, :pyramidToMax], v
diff --git a/lib/axlsx/drawing/bar_series.rb b/lib/axlsx/drawing/bar_series.rb
index a649a68a..d266dd09 100644
--- a/lib/axlsx/drawing/bar_series.rb
+++ b/lib/axlsx/drawing/bar_series.rb
@@ -15,9 +15,8 @@ module Axlsx
# @return [Array, SimpleTypedList]
attr_reader :labels
- # The shabe of the bars or columns
- # must be one of [:percentStacked, :clustered, :standard, :stacked]
- # @return [Symbol]
+ # The shape of the bars or columns
+ # @return [Symbol] must be one of [:cone, :coneToMax, :box, :cylinder, :pyramid, :pyramidToMax]
attr_reader :shape
# An array of rgb colors to apply to your bar chart.
@@ -41,8 +40,7 @@ module Axlsx
# @see colors
def colors=(v) DataTypeValidator.validate "BarSeries.colors", [Array], v; @colors = v end
- # The shabe of the bars or columns
- # must be one of [:cone, :coneToMax, :box, :cylinder, :pyramid, :pyramidToMax]
+ # @see shape
def shape=(v)
RestrictionValidator.validate "BarSeries.shape", [:cone, :coneToMax, :box, :cylinder, :pyramid, :pyramidToMax], v
@shape = v
diff --git a/lib/axlsx/package.rb b/lib/axlsx/package.rb
index 56410339..41bfdb11 100644
--- a/lib/axlsx/package.rb
+++ b/lib/axlsx/package.rb
@@ -68,13 +68,6 @@ module Axlsx
@workbook
end
- #def self.parse(input, confirm_valid = false)
- # p = Package.new
- # z = Zip::File.open(input)
- # p.workbook = Workbook.parse z.get_entry(WORKBOOK_PN)
- # p
- #end
-
# @see workbook
def workbook=(workbook) DataTypeValidator.validate :Package_workbook, Workbook, workbook; @workbook = workbook; end
@@ -139,7 +132,7 @@ module Axlsx
# dcterms and xml namespaces. Those remote schema are included in this gem, and the original files have been altered to
# refer to the local versions.
#
- # If by chance you are able to creat a package that does not validate it indicates that the internal
+ # If by chance you are able to create a package that does not validate it indicates that the internal
# validation is not robust enough and needs to be improved. Please report your errors to the gem author.
# @see http://www.ecma-international.org/publications/standards/Ecma-376.htm
# @example
@@ -355,4 +348,3 @@ module Axlsx
end
end
end
-
diff --git a/lib/axlsx/util/parser.rb b/lib/axlsx/util/parser.rb
deleted file mode 100644
index 78b819bd..00000000
--- a/lib/axlsx/util/parser.rb
+++ /dev/null
@@ -1,44 +0,0 @@
-# encoding: UTF-8
-module Axlsx
- # The Parser module mixes in a number of methods to help in generating a model from xml
- # This module is not included in the axlsx library at this time. It is for future development only,
- module Parser
-
- # The xml to be parsed
- attr_accessor :parser_xml
-
- # parse and assign string attribute
- def parse_string attr_name, xpath
- send("#{attr_name}=", parse_value(xpath))
- end
-
- # parse convert and assign node text to symbol
- def parse_symbol attr_name, xpath
- v = parse_value xpath
- v = v.to_sym unless v.nil?
- send("#{attr_name}=", v)
- end
-
- # parse, convert and assign note text to integer
- def parse_integer attr_name, xpath
- v = parse_value xpath
- v = v.to_i if v.respond_to?(:to_i)
- send("#{attr_name}=", v)
- end
-
- # parse, convert and assign node text to float
- def parse_float attr_name, xpath
- v = parse_value xpath
- v = v.to_f if v.respond_to?(:to_f)
- send("#{attr_name}=", v)
- end
-
- # return node text based on xpath
- def parse_value xpath
- node = parser_xml.xpath(xpath)
- return nil if node.empty?
- node.text.strip
- end
-
- end
-end
diff --git a/lib/axlsx/workbook/workbook.rb b/lib/axlsx/workbook/workbook.rb
index 7572e51f..48b7f882 100644
--- a/lib/axlsx/workbook/workbook.rb
+++ b/lib/axlsx/workbook/workbook.rb
@@ -197,15 +197,6 @@ require 'axlsx/workbook/worksheet/selection.rb'
@worksheets[index] if index
end
- # lets come back to this later when we are ready for parsing.
- #def self.parse entry
- # io = entry.get_input_stream
- # w = self.new
- # w.parser_xml = Nokogiri::XML(io.read)
- # w.parse_string :date1904, "//xmlns:workbookPr/@date1904"
- # w
- #end
-
# Creates a new Workbook
# The recomended way to work with workbooks is via Package#workbook
# @option options [Boolean] date1904. If this is not specified, date1904 is set to false. Office 2011 for Mac defaults to false.
diff --git a/lib/axlsx/workbook/worksheet/cell.rb b/lib/axlsx/workbook/worksheet/cell.rb
index fb10ad36..99b3f8b0 100644
--- a/lib/axlsx/workbook/worksheet/cell.rb
+++ b/lib/axlsx/workbook/worksheet/cell.rb
@@ -12,7 +12,7 @@ module Axlsx
# @param [Row] row The row this cell belongs to.
# @param [Any] value The value associated with this cell.
- # @option options [Symbol] type The intended data type for this cell. If not specified the data type will be determined internally based on the vlue provided.
+ # @option options [Symbol] type The intended data type for this cell. If not specified the data type will be determined internally based on the value provided.
# @option options [Integer] style The index of the cellXfs item to be applied to this cell. If not specified, the default style (0) will be applied.
# @option options [String] font_name
# @option options [Integer] charset
diff --git a/lib/axlsx/workbook/worksheet/worksheet.rb b/lib/axlsx/workbook/worksheet/worksheet.rb
index 6fbd384e..9cfefa51 100644
--- a/lib/axlsx/workbook/worksheet/worksheet.rb
+++ b/lib/axlsx/workbook/worksheet/worksheet.rb
@@ -656,7 +656,7 @@ module Axlsx
def validate_sheet_name(name)
DataTypeValidator.validate :worksheet_name, String, name
- raise ArgumentError, (ERR_SHEET_NAME_TOO_LONG % name) if name.size > 31
+ raise ArgumentError, (ERR_SHEET_NAME_TOO_LONG % name) if name.bytesize > 31
raise ArgumentError, (ERR_SHEET_NAME_CHARACTER_FORBIDDEN % name) if '[]*/\?:'.chars.any? { |char| name.include? char }
name = Axlsx::coder.encode(name)
sheet_names = @workbook.worksheets.reject { |s| s == self }.map { |s| s.name }