caxlsx 4.4.2 → 4.5.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 +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/axlsx/util/zip_command.rb +1 -1
- data/lib/axlsx/version.rb +1 -1
- data/lib/axlsx/workbook/worksheet/pivot_table.rb +30 -3
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4788f1b6fd206e4e4727a10114249a6ddd0eb8e3d3eed2d1f74e43e6c415b1fc
|
|
4
|
+
data.tar.gz: c8883c5e7ed0f029cb3b09f3741f724bb2ebe823c6084524e9ba72468f6291ef
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d8c5703e775090e2b1a9fec353f67e713d83ac21d6bfe980d45fc876b5506ca849ee37d8e6588b759c7434c66d444f15f90c9da6e4026042a43fc7a5910de831
|
|
7
|
+
data.tar.gz: 79e6e3341fdff59db93bc8534d77edaf2817305ab3053d0daaa66a2b3a8323f60ef07a8b49a6301d2985dc818795233c7879500f45b61b2296a454adb7df9e47
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@ CHANGELOG
|
|
|
2
2
|
---------
|
|
3
3
|
- **Unreleased**
|
|
4
4
|
|
|
5
|
+
- **June.09.26**: 4.5.0
|
|
6
|
+
- [PR #527](https://github.com/caxlsx/caxlsx/pull/527) Fix PivotTable countNums subtotal label never applied. Solves [Issue #526](https://github.com/caxlsx/caxlsx/issues/526)
|
|
7
|
+
- [PR #522](https://github.com/caxlsx/caxlsx/pull/522) Allow custom name for pivot table data fields via :name option
|
|
8
|
+
- [PR #520](https://github.com/caxlsx/caxlsx/pull/520) Add `use_auto_formatting` and `apply_width_height_formats` accessors to `PivotTable`
|
|
9
|
+
- [PR #517](https://github.com/caxlsx/caxlsx/pull/517) Fix invalid XML when pivot table has both `columns` and multiple `data` fields configured. Solves [Issue #414](https://github.com/caxlsx/caxlsx/issues/414)
|
|
10
|
+
|
|
5
11
|
- **March.23.26**: 4.4.2
|
|
6
12
|
- [PR #510](https://github.com/caxlsx/caxlsx/pull/510) Add configurable `major_tick_mark` and `minor_tick_mark` attributes to chart axes
|
|
7
13
|
- [PR #495](https://github.com/caxlsx/caxlsx/pull/495) Make worksheet name length validation optional
|
|
@@ -40,7 +40,7 @@ module Axlsx
|
|
|
40
40
|
@current_file = "#{@dir}/#{entry.name}"
|
|
41
41
|
@files << entry.name
|
|
42
42
|
FileUtils.mkdir_p(File.dirname(@current_file))
|
|
43
|
-
@io = File.open(@current_file, "wb")
|
|
43
|
+
@io = File.open(@current_file, "wb")
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
# Write to a buffer that will be written to the current entry
|
data/lib/axlsx/version.rb
CHANGED
|
@@ -29,6 +29,8 @@ module Axlsx
|
|
|
29
29
|
@grand_totals = :both
|
|
30
30
|
@sort_on_headers = {}
|
|
31
31
|
@style_info = {}
|
|
32
|
+
@use_auto_formatting = true
|
|
33
|
+
@apply_width_height_formats = true
|
|
32
34
|
parse_options options
|
|
33
35
|
yield self if block_given?
|
|
34
36
|
end
|
|
@@ -85,6 +87,14 @@ module Axlsx
|
|
|
85
87
|
# @return [Worksheet]
|
|
86
88
|
attr_writer :data_sheet
|
|
87
89
|
|
|
90
|
+
# Whether to apply auto formatting to the pivot table.
|
|
91
|
+
# @return [Boolean]
|
|
92
|
+
attr_accessor :use_auto_formatting
|
|
93
|
+
|
|
94
|
+
# Whether to apply width/height formats to the pivot table.
|
|
95
|
+
# @return [Boolean]
|
|
96
|
+
attr_accessor :apply_width_height_formats
|
|
97
|
+
|
|
88
98
|
# @see #data_sheet
|
|
89
99
|
def data_sheet
|
|
90
100
|
@data_sheet || @sheet
|
|
@@ -207,7 +217,11 @@ module Axlsx
|
|
|
207
217
|
str << ' dataOnRows="1"' if data.size <= 1
|
|
208
218
|
str << ' rowGrandTotals="0"' if grand_totals == :col_only || grand_totals == :none
|
|
209
219
|
str << ' colGrandTotals="0"' if grand_totals == :row_only || grand_totals == :none
|
|
210
|
-
str << ' applyNumberFormats="0" applyBorderFormats="0" applyFontFormats="0" applyPatternFormats="0" applyAlignmentFormats="0"
|
|
220
|
+
str << ' applyNumberFormats="0" applyBorderFormats="0" applyFontFormats="0" applyPatternFormats="0" applyAlignmentFormats="0"'
|
|
221
|
+
str << ' applyWidthHeightFormats="' << (@apply_width_height_formats ? '1' : '0') << '"'
|
|
222
|
+
str << ' dataCaption="Data" showMultipleLabel="0" showMemberPropertyTips="0"'
|
|
223
|
+
str << ' useAutoFormatting="' << (@use_auto_formatting ? '1' : '0') << '"'
|
|
224
|
+
str << ' indent="0" compact="0" compactData="0" gridDropZones="1" multipleFieldFilters="0">'
|
|
211
225
|
|
|
212
226
|
str << '<location firstDataCol="1" firstDataRow="1" firstHeaderRow="1" ref="' << ref << '"/>'
|
|
213
227
|
str << '<pivotFields count="' << header_cells_count.to_s << '">'
|
|
@@ -246,6 +260,18 @@ module Axlsx
|
|
|
246
260
|
else
|
|
247
261
|
str << '<colItems count="1"><i/></colItems>'
|
|
248
262
|
end
|
|
263
|
+
elsif data.size > 1
|
|
264
|
+
str << '<colFields count="' << (columns.size + 1).to_s << '">'
|
|
265
|
+
columns.each do |column_value|
|
|
266
|
+
str << '<field x="' << header_index_of(column_value).to_s << '"/>'
|
|
267
|
+
end
|
|
268
|
+
str << '<field x="-2"/></colFields>'
|
|
269
|
+
str << "<colItems count=\"#{data.size}\">"
|
|
270
|
+
str << '<i><x/></i>'
|
|
271
|
+
(data.size - 1).times do |i|
|
|
272
|
+
str << "<i i=\"#{i + 1}\"><x v=\"#{i + 1}\"/></i>"
|
|
273
|
+
end
|
|
274
|
+
str << '</colItems>'
|
|
249
275
|
else
|
|
250
276
|
str << '<colFields count="' << columns.size.to_s << '">'
|
|
251
277
|
columns.each do |column_value|
|
|
@@ -264,8 +290,9 @@ module Axlsx
|
|
|
264
290
|
str << "<dataFields count=\"#{data.size}\">"
|
|
265
291
|
data.each do |datum_value|
|
|
266
292
|
subtotal_name = datum_value[:subtotal] || 'sum'
|
|
267
|
-
subtotal_name = 'count' if
|
|
268
|
-
|
|
293
|
+
subtotal_name = 'count' if datum_value[:subtotal] == 'countNums' # both count & countNums are labelled as count
|
|
294
|
+
field_name = datum_value[:name] || "#{subtotal_name.capitalize} of #{datum_value[:ref]}"
|
|
295
|
+
str << "<dataField name='#{field_name}' fld='#{header_index_of(datum_value[:ref])}' baseField='0' baseItem='0'"
|
|
269
296
|
str << " numFmtId='#{datum_value[:num_fmt]}'" if datum_value[:num_fmt]
|
|
270
297
|
str << " subtotal='#{datum_value[:subtotal]}' " if datum_value[:subtotal]
|
|
271
298
|
str << "/>"
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: caxlsx
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.
|
|
4
|
+
version: 4.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Randy Morgan
|
|
@@ -312,7 +312,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
312
312
|
- !ruby/object:Gem::Version
|
|
313
313
|
version: '0'
|
|
314
314
|
requirements: []
|
|
315
|
-
rubygems_version: 4.0.
|
|
315
|
+
rubygems_version: 4.0.10
|
|
316
316
|
specification_version: 4
|
|
317
317
|
summary: Excel OOXML (xlsx) with charts, styles, images and autowidth columns.
|
|
318
318
|
test_files: []
|