summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorSamuel de Framond <[email protected]>2013-06-12 19:23:59 +0800
committerSamuel de Framond <[email protected]>2013-06-12 21:19:17 +0800
commit6a80d144f017fb9b61e264e7d46dbebe1b60ede3 (patch)
tree7481db6047ed5a9baab4f38c3c603f7e042fdfec
parent00cb09391927aaea08de304f3faad3afdbff2b18 (diff)
downloadcaxlsx-6a80d144f017fb9b61e264e7d46dbebe1b60ede3.tar.gz
caxlsx-6a80d144f017fb9b61e264e7d46dbebe1b60ede3.zip
Add a subtotal option to PivotTable (dirty).
-rw-r--r--lib/axlsx/workbook/worksheet/pivot_table.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/axlsx/workbook/worksheet/pivot_table.rb b/lib/axlsx/workbook/worksheet/pivot_table.rb
index 4ebcdee8..745aaeca 100644
--- a/lib/axlsx/workbook/worksheet/pivot_table.rb
+++ b/lib/axlsx/workbook/worksheet/pivot_table.rb
@@ -23,10 +23,13 @@ module Axlsx
@columns = []
@data = []
@pages = []
+ @subtotal = 'sum'
parse_options options
yield self if block_given?
end
+ attr_writer :subtotal
+
# The reference to the table data
# @return [String]
attr_reader :ref
@@ -190,7 +193,7 @@ module Axlsx
data.each do |datum_value|
str << '<dataField name="Sum of ' << datum_value << '" ' <<
'fld="' << header_index_of(datum_value).to_s << '" ' <<
- 'baseField="0" baseItem="0"/>'
+ 'baseField="0" baseItem="0" subtotal="' << @subtotal << '"/>'
end
str << '</dataFields>'
end