diff options
| -rw-r--r-- | .github/workflows/stale.yml | 29 | ||||
| -rw-r--r-- | CHANGELOG.md | 6 | ||||
| -rw-r--r-- | README.md | 5 | ||||
| -rw-r--r-- | lib/axlsx.rb | 2 | ||||
| -rw-r--r-- | lib/axlsx/drawing/bar_chart.rb | 6 | ||||
| -rw-r--r-- | lib/axlsx/drawing/bar_series.rb | 8 | ||||
| -rw-r--r-- | lib/axlsx/package.rb | 10 | ||||
| -rw-r--r-- | lib/axlsx/util/parser.rb | 44 | ||||
| -rw-r--r-- | lib/axlsx/workbook/workbook.rb | 9 | ||||
| -rw-r--r-- | lib/axlsx/workbook/worksheet/cell.rb | 2 | ||||
| -rw-r--r-- | lib/axlsx/workbook/worksheet/worksheet.rb | 2 | ||||
| -rw-r--r-- | test/workbook/worksheet/tc_worksheet.rb | 11 |
12 files changed, 57 insertions, 77 deletions
diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 00000000..e51cf505 --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,29 @@ +name: Mark stale issues and pull requests + +on: + schedule: + - cron: "0 0 * * *" + +jobs: + stale: + + runs-on: ubuntu-latest + + steps: + - uses: actions/stale@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + days-before-stale: 90 + days-before-close: 7 + stale-issue-message: > + This issue has been automatically marked as stale because it has not been commented on for at least three months. + It will be automatically closed in 7 days. + + If you have any new information or updates please reply in order to keep the issue open. + stale-pr-message: > + This pull request has been automatically marked as stale because has been no activity for at least three months. + It will be automatically closed in 7 days. + + If you have any new information or updates please reply in order to keep the pull request open. + stale-issue-label: stale + stale-pr-label: stale diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ef11371..720fa9d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ CHANGELOG - Fix Relationship.instances cache - Autoload fix for Rails +- **October.4.19**: 2.0.2 + - Released as caxlsx, fork of axlsx + - Update ruby-zip dependency (fixes https://github.com/randym/axlsx/issues/536) + - **September.17.19**: 3.0.0 - First release of caxlsx, fork of axlsx @@ -54,7 +58,7 @@ CHANGELOG Please be sure that you will never have <, >, etc in your content or the XML will be invalid. - Rewrote cell serialization to improve performance - Added iso_8601 type to support text based date and time management. - - Bug fix for relationahip management in drawings when you add images + - Bug fix for relationship management in drawings when you add images and charts to the same worksheet drawing. - Added outline_level_rows and outline_level_columns to worksheet to simplify setting up outlining in the worksheet. - Added support for pivot tables @@ -114,7 +114,7 @@ Additional documentation is listed below: Feel free to add your question (including an answer!) to the FAQ if you think it is of general interest. -## Plugins & Integrations +## Plugins, Integrations, and Extensions Currently the following additional gems are available: @@ -124,7 +124,8 @@ Currently the following additional gems are available: * Provides a `.axlsx` renderer to Rails so you can move all your spreadsheet code from your controller into view files. - [activeadmin-caxlsx](https://github.com/caxlsx/activeadmin-caxlsx) * An Active Admin plugin that includes DSL to create downloadable reports. - +- [axlsx_styler](https://github.com/axlsx-styler-gem/axlsx_styler) + * Allows you to build clean and maintainable styles for your axlsx spreadsheets. Build your spreadsheeet with data and then apply styles later. ## Known Software Interoperability Issues 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 } diff --git a/test/workbook/worksheet/tc_worksheet.rb b/test/workbook/worksheet/tc_worksheet.rb index fa8832d8..781f5250 100644 --- a/test/workbook/worksheet/tc_worksheet.rb +++ b/test/workbook/worksheet/tc_worksheet.rb @@ -29,6 +29,17 @@ class TestWorksheet < Test::Unit::TestCase assert_raises(ArgumentError) { @ws.name = 'foo?bar' } end + def test_exception_if_name_too_long + assert_nothing_raised { @ws.name = 'x' * 31 } + assert_raises(ArgumentError) { @ws.name = 'x' * 32 } + end + + def test_exception_if_name_too_long_because_of_multibyte_characters + three_byte_character = "✔" + assert_nothing_raised { @ws.name = 'x' * 28 + three_byte_character} + assert_raises(ArgumentError) { @ws.name = 'x' * 29 + three_byte_character } + end + def test_page_margins assert(@ws.page_margins.is_a? Axlsx::PageMargins) end |
