caxlsx 4.2.0 → 4.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b15095b3a73b9f2e11f59bb674964ce206e11e699937e109831d9422fd26750f
4
- data.tar.gz: e20e938a224f9da043fd4c7cfcd2c35af03a5bb037fc9164a59c44c110e3e248
3
+ metadata.gz: c0f9a2b86a38ca45670bc0e74443d58a8d56b89a5d3d4891641bf6168fbcba02
4
+ data.tar.gz: b8f16b2ae2e718fb07c763c4085da9acbc3982ab63bffcee3de5a9b5741e504c
5
5
  SHA512:
6
- metadata.gz: 8cdd4b3843dd886f864212ecb4a40f528543d4fd1c682079c5497d3c40ea684bc64d214db4a974d3cea2071663bc3cfbd501543d6868077d9b369340c751bd90
7
- data.tar.gz: 520da353dfbc0022ac6a3aae5006e669fd6f291aad95797b2ff24a2cf1634de4f66c52616efa2af5bfbd7524cf91393d56a6e6a433131f988402e277cacbaca5
6
+ metadata.gz: b2830801b587922e0e765d147e7eaa01d33527d82efc3950d4241889e828fabf814270c64d0f18c4dd91880eaa848cff3a7c4b7c3f4f38e1ba95ef004900208b
7
+ data.tar.gz: f08afe03aedf885c94f035b69302bcd55a024efe4801c056a9383b47b2f5052d7fb4259b74bda32e82ecb6d2ece041e89573a26c233330991467d66344fc7689
data/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@ CHANGELOG
2
2
  ---------
3
3
  - **Unreleased**
4
4
 
5
+
6
+ - **August.16.25**: 4.3.0
7
+ - [PR #421](https://github.com/caxlsx/caxlsx/pull/421) Add Rubyzip >= 2.4 support
8
+ - [PR #448](https://github.com/caxlsx/caxlsx/pull/448) Fix Bar Chart: set axis position for Apple Numbers compatibility
9
+ - [PR #466](https://github.com/caxlsx/caxlsx/pull/466) Use RubyGem's trusted publishing
10
+ - [PR #467](https://github.com/caxlsx/caxlsx/pull/467) Add JRuby 10.0 to the CI
11
+
5
12
  - **December.15.24**: 4.2.0
6
13
  - [PR #359](https://github.com/caxlsx/caxlsx/pull/359) Add `PivotTable#grand_totals` option to remove grand totals row/col
7
14
  - [PR #362](https://github.com/caxlsx/caxlsx/pull/362) Use widest width even if provided as fixed value
data/README.md CHANGED
@@ -107,6 +107,12 @@ Additional documentation is listed below:
107
107
  - [Style Reference](https://github.com/caxlsx/caxlsx/blob/master/docs/style_reference.md)
108
108
  - [Header and Footer Codes](https://github.com/caxlsx/caxlsx/blob/master/docs/header_and_footer_codes.md)
109
109
 
110
+ You can run the documentation on your local by running the following:
111
+ ```sh
112
+ gem install webrick
113
+ yard server
114
+ ```
115
+
110
116
  ⚠ Please __do not create issues__ for questions regarding the usage of axlsx / caxlsx. Look through this README, the [examples folder](https://github.com/caxlsx/caxlsx/tree/master/examples), and the [FAQ](https://github.com/caxlsx/caxlsx/wiki/FAQ), and also check [questions tagged `axlsx` on Stack Overflow](https://stackoverflow.com/questions/tagged/axlsx).
111
117
 
112
118
  Feel free to add your question (including an answer!) to the FAQ if you think it is of general interest.
data/Rakefile CHANGED
@@ -1,10 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require File.expand_path("#{File.dirname(__FILE__)}/lib/axlsx/version.rb")
4
-
5
- task build: :gendoc do
6
- system "gem build axlsx.gemspec"
7
- end
3
+ require 'bundler'
4
+ Bundler::GemHelper.install_tasks
8
5
 
9
6
  task :benchmark do
10
7
  require File.expand_path("#{File.dirname(__FILE__)}/test/benchmark.rb")
@@ -23,8 +20,4 @@ Rake::TestTask.new do |t|
23
20
  t.warning = true
24
21
  end
25
22
 
26
- task release: :build do
27
- system "gem push caxlsx-#{Axlsx::VERSION}.gem"
28
- end
29
-
30
23
  task default: :test
@@ -141,7 +141,17 @@ module Axlsx
141
141
  # category axes specified via axes[:val_axes] and axes[:cat_axis]
142
142
  # @return [Axes]
143
143
  def axes
144
- @axes ||= Axes.new(cat_axis: CatAxis, val_axis: ValAxis)
144
+ @axes ||= begin
145
+ a = Axes.new(cat_axis: CatAxis, val_axis: ValAxis)
146
+
147
+ if bar_dir == :col
148
+ a[:val_axis].ax_pos = :l
149
+ else
150
+ a[:cat_axis].ax_pos = :l
151
+ end
152
+
153
+ a
154
+ end
145
155
  end
146
156
  end
147
157
  end
@@ -131,7 +131,17 @@ module Axlsx
131
131
  # category axes specified via axes[:val_axes] and axes[:cat_axis]
132
132
  # @return [Axes]
133
133
  def axes
134
- @axes ||= Axes.new(cat_axis: CatAxis, val_axis: ValAxis)
134
+ @axes ||= begin
135
+ a = Axes.new(cat_axis: CatAxis, val_axis: ValAxis)
136
+
137
+ if bar_dir == :col
138
+ a[:val_axis].ax_pos = :l
139
+ else
140
+ a[:cat_axis].ax_pos = :l
141
+ end
142
+
143
+ a
144
+ end
135
145
  end
136
146
  end
137
147
  end
@@ -6,6 +6,7 @@ module Axlsx
6
6
  # @see README for examples
7
7
  class Chart
8
8
  include Axlsx::OptionsParser
9
+
9
10
  # Creates a new chart object
10
11
  # @param [GraphicalFrame] frame The frame that holds this chart.
11
12
  # @option options [Cell, String] title
@@ -9,6 +9,7 @@ module Axlsx
9
9
  class DLbls
10
10
  include Axlsx::Accessors
11
11
  include Axlsx::OptionsParser
12
+
12
13
  # creates a new DLbls object
13
14
  def initialize(chart_type, options = {})
14
15
  raise ArgumentError, 'chart_type must inherit from Chart' unless [Chart, LineChart].include?(chart_type.superclass)
@@ -56,7 +56,7 @@ module Axlsx
56
56
  <x:AutoFill>False</x:AutoFill>
57
57
  <x:Row>#{row}</x:Row>
58
58
  <x:Column>#{column}</x:Column>
59
- #{@visible ? '<x:Visible/>' : ''}
59
+ #{'<x:Visible/>' if @visible}
60
60
  </x:ClientData>
61
61
  </v:shape>
62
62
  XML
data/lib/axlsx/package.rb CHANGED
@@ -147,7 +147,7 @@ module Axlsx
147
147
 
148
148
  # Encrypt the package into a CFB using the password provided
149
149
  # This is not ready yet
150
- def encrypt(file_name, password)
150
+ def encrypt(file_name, password) # rubocop:disable Naming/PredicateMethod
151
151
  false
152
152
  # moc = MsOffCrypto.new(file_name, password)
153
153
  # moc.save
@@ -211,7 +211,8 @@ module Axlsx
211
211
  # @return [Zip::Entry]
212
212
  def zip_entry_for_part(part)
213
213
  timestamp = Zip::DOSTime.at(@core.created.to_i)
214
- Zip::Entry.new("", part[:entry], "", "", 0, 0, Zip::Entry::DEFLATED, 0, timestamp)
214
+
215
+ Zip::Entry.new("", part[:entry], time: timestamp)
215
216
  end
216
217
 
217
218
  # The parts of a package
@@ -4,6 +4,7 @@ module Axlsx
4
4
  # A border part.
5
5
  class BorderPr
6
6
  include Axlsx::OptionsParser
7
+
7
8
  # @return [Color] The color of this border part.
8
9
  attr_reader :color
9
10
 
@@ -6,6 +6,7 @@ module Axlsx
6
6
  # @see Style#add_style
7
7
  class PatternFill
8
8
  include Axlsx::OptionsParser
9
+
9
10
  # Creates a new PatternFill Object
10
11
  # @option options [Symbol] patternType
11
12
  # @option options [Color] fgColor
@@ -8,6 +8,7 @@ module Axlsx
8
8
 
9
9
  include Axlsx::SerializedAttributes
10
10
  include Axlsx::OptionsParser
11
+
11
12
  # Creates a new Xf object
12
13
  # @option options [Integer] numFmtId
13
14
  # @option options [Integer] fontId
@@ -19,7 +19,7 @@ module Axlsx
19
19
  #
20
20
  # The directory and its contents are removed at the end of the block.
21
21
  def self.open(file_name, encrypter = nil)
22
- Zip::OutputStream.open(file_name, encrypter) do |zos|
22
+ Zip::OutputStream.open(file_name, encrypter: encrypter) do |zos|
23
23
  bzos = new(zos)
24
24
  yield(bzos)
25
25
  ensure
@@ -28,7 +28,7 @@ module Axlsx
28
28
  end
29
29
 
30
30
  def self.write_buffer(io = ::StringIO.new, encrypter = nil)
31
- Zip::OutputStream.write_buffer(io, encrypter) do |zos|
31
+ Zip::OutputStream.write_buffer(io, encrypter: encrypter) do |zos|
32
32
  bzos = new(zos)
33
33
  yield(bzos)
34
34
  ensure
@@ -183,8 +183,7 @@ module Axlsx
183
183
  end
184
184
 
185
185
  def to_xml_string(str = +'')
186
- classname = @allowed_types[0].name.split('::').last
187
- el_name = serialize_as.to_s || (classname[0, 1].downcase + classname[1..])
186
+ el_name = serialize_as.to_s
188
187
  str << '<' << el_name << ' count="' << size.to_s << '">'
189
188
  each { |item| item.to_xml_string(str) }
190
189
  str << '</' << el_name << '>'
@@ -9,7 +9,7 @@ module Axlsx
9
9
  # @param [Any] v The value to be validated
10
10
  # @raise [ArgumentError] Raised if the value provided is not in the list of choices.
11
11
  # @return [Boolean] true if validation succeeds.
12
- def self.validate(name, choices, v)
12
+ def self.validate(name, choices, v) # rubocop:disable Naming/PredicateMethod
13
13
  raise ArgumentError, format(ERR_RESTRICTION, v.to_s, name, choices.inspect) unless choices.include?(v)
14
14
 
15
15
  true
data/lib/axlsx/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Axlsx
4
4
  # The current version
5
- VERSION = "4.2.0"
5
+ VERSION = "4.3.0"
6
6
  end
@@ -54,6 +54,7 @@ module Axlsx
54
54
  include Axlsx::SerializedAttributes
55
55
  include Axlsx::OptionsParser
56
56
  include Axlsx::Accessors
57
+
57
58
  # creates a new DefinedName.
58
59
  # @param [String] formula - the formula the defined name references
59
60
  # @param [Hash] options - A hash of key/value pairs that will be mapped to this instances attributes.
@@ -41,7 +41,7 @@ module Axlsx
41
41
  # date_group_items restrictions.
42
42
  # @param [Cell] cell The cell to test against items
43
43
  # TODO implement this for date filters as well!
44
- def apply(cell)
44
+ def apply(cell) # rubocop:disable Naming/PredicateMethod
45
45
  return false unless cell
46
46
 
47
47
  filter_items.each do |filter|
@@ -166,7 +166,7 @@ module Axlsx
166
166
 
167
167
  # Indicates that the cell has one or more of the custom cell styles applied.
168
168
  # @return [Boolean]
169
- def is_text_run? # rubocop:disable Naming/PredicateName
169
+ def is_text_run? # rubocop:disable Naming/PredicatePrefix
170
170
  defined?(@is_text_run) && @is_text_run && !contains_rich_text?
171
171
  end
172
172
 
@@ -410,13 +410,13 @@ module Axlsx
410
410
  CellSerializer.to_xml_string r_index, c_index, self, str
411
411
  end
412
412
 
413
- def is_formula? # rubocop:disable Naming/PredicateName
413
+ def is_formula? # rubocop:disable Naming/PredicatePrefix
414
414
  return false if escape_formulas
415
415
 
416
416
  type == :string && @value.to_s.start_with?(FORMULA_PREFIX)
417
417
  end
418
418
 
419
- def is_array_formula? # rubocop:disable Naming/PredicateName
419
+ def is_array_formula? # rubocop:disable Naming/PredicatePrefix
420
420
  return false if escape_formulas
421
421
 
422
422
  type == :string &&
@@ -9,6 +9,7 @@ module Axlsx
9
9
 
10
10
  include Axlsx::OptionsParser
11
11
  include Axlsx::SerializedAttributes
12
+
12
13
  # Create a new Col objects
13
14
  # @param min First column affected by this 'column info' record.
14
15
  # @param max Last column affected by this 'column info' record.
@@ -7,7 +7,7 @@ module Axlsx
7
7
  # of plain text and control characters. A fairly comprehensive list of control
8
8
  # characters can be found here:
9
9
  # https://github.com/randym/axlsx/blob/master/notes_on_header_footer.md
10
- #     
10
+ #
11
11
  # @note The recommended way of managing header/footers is via Worksheet#header_footer
12
12
  # @see Worksheet#initialize
13
13
  class HeaderFooter
@@ -8,6 +8,7 @@ module Axlsx
8
8
  class Pane
9
9
  include Axlsx::OptionsParser
10
10
  include Axlsx::SerializedAttributes
11
+
11
12
  # Creates a new {Pane} object
12
13
  # @option options [Symbol] active_pane Active Pane
13
14
  # @option options [Symbol] state Split State
@@ -343,7 +343,7 @@ module Axlsx
343
343
  attributes << 'dataField="1"'
344
344
  end
345
345
 
346
- "<pivotField #{attributes.join(' ')}>#{include_items_tag ? items_tag : nil}</pivotField>"
346
+ "<pivotField #{attributes.join(' ')}>#{items_tag if include_items_tag}</pivotField>"
347
347
  end
348
348
 
349
349
  def data_refs
@@ -10,6 +10,7 @@ module Axlsx
10
10
  include Axlsx::OptionsParser
11
11
  include Axlsx::SerializedAttributes
12
12
  include Axlsx::Accessors
13
+
13
14
  # Creates a new PrintOptions object
14
15
  # @option options [Boolean] grid_lines Whether grid lines should be printed
15
16
  # @option options [Boolean] headings Whether row and column headings should be printed
@@ -7,6 +7,7 @@ module Axlsx
7
7
  include Axlsx::OptionsParser
8
8
  include Axlsx::SerializedAttributes
9
9
  include Axlsx::Accessors
10
+
10
11
  # creates a new SheetCalcPr
11
12
  # @param [Hash] options Options for this object
12
13
  # @option [Boolean] full_calc_on_load @see full_calc_on_load
@@ -7,6 +7,7 @@ module Axlsx
7
7
  include Axlsx::OptionsParser
8
8
  include Axlsx::SerializedAttributes
9
9
  include Axlsx::Accessors
10
+
10
11
  # creates a new TableStyleInfo instance
11
12
  # @param [Hash] options
12
13
  # @option [Boolean] show_first_column indicates if the first column should
@@ -37,7 +37,7 @@ module Axlsx
37
37
 
38
38
  # Helper method to tell us if there are comments in the comments collection
39
39
  # @return [Boolean]
40
- def has_comments? # rubocop:disable Naming/PredicateName
40
+ def has_comments? # rubocop:disable Naming/PredicatePrefix
41
41
  !comments.empty?
42
42
  end
43
43
 
@@ -42,7 +42,7 @@ module Axlsx
42
42
 
43
43
  # helper method to tell us if the drawing has something in it or not
44
44
  # @return [Boolean]
45
- def has_drawing? # rubocop:disable Naming/PredicateName
45
+ def has_drawing? # rubocop:disable Naming/PredicatePrefix
46
46
  @drawing.is_a? Drawing
47
47
  end
48
48
 
@@ -6,6 +6,7 @@ module Axlsx
6
6
  include Axlsx::OptionsParser
7
7
  include Axlsx::Accessors
8
8
  include Axlsx::SerializedAttributes
9
+
9
10
  # Creates a new hyperlink object.
10
11
  # @note the preferred way to add hyperlinks to your worksheet is the Worksheet#add_hyperlink method
11
12
  # @param [Worksheet] worksheet the Worksheet that owns this hyperlink
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caxlsx
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.0
4
+ version: 4.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Randy Morgan
8
8
  - Jurriaan Pruis
9
- autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2024-12-15 00:00:00.000000000 Z
11
+ date: 1980-01-02 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: htmlentities
@@ -71,20 +70,20 @@ dependencies:
71
70
  requirements:
72
71
  - - ">="
73
72
  - !ruby/object:Gem::Version
74
- version: 1.3.0
73
+ version: '2.4'
75
74
  - - "<"
76
75
  - !ruby/object:Gem::Version
77
- version: '3'
76
+ version: '4'
78
77
  type: :runtime
79
78
  prerelease: false
80
79
  version_requirements: !ruby/object:Gem::Requirement
81
80
  requirements:
82
81
  - - ">="
83
82
  - !ruby/object:Gem::Version
84
- version: 1.3.0
83
+ version: '2.4'
85
84
  - - "<"
86
85
  - !ruby/object:Gem::Version
87
- version: '3'
86
+ version: '4'
88
87
  description: 'xlsx spreadsheet generation with charts, images, automated column width,
89
88
  customizable styles and full schema validation. Axlsx helps you create beautiful
90
89
  Office Open XML Spreadsheet documents (Excel, Google Spreadsheets, Numbers, LibreOffice)
@@ -297,7 +296,6 @@ metadata:
297
296
  changelog_uri: https://github.com/caxlsx/caxlsx/blob/master/CHANGELOG.md
298
297
  source_code_uri: https://github.com/caxlsx/caxlsx
299
298
  rubygems_mfa_required: 'true'
300
- post_install_message:
301
299
  rdoc_options: []
302
300
  require_paths:
303
301
  - lib
@@ -312,8 +310,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
312
310
  - !ruby/object:Gem::Version
313
311
  version: '0'
314
312
  requirements: []
315
- rubygems_version: 3.4.19
316
- signing_key:
313
+ rubygems_version: 3.6.9
317
314
  specification_version: 4
318
315
  summary: Excel OOXML (xlsx) with charts, styles, images and autowidth columns.
319
316
  test_files: []