summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-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