From 6a80d144f017fb9b61e264e7d46dbebe1b60ede3 Mon Sep 17 00:00:00 2001 From: Samuel de Framond Date: Wed, 12 Jun 2013 19:23:59 +0800 Subject: Add a subtotal option to PivotTable (dirty). --- lib/axlsx/workbook/worksheet/pivot_table.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 << '' + 'baseField="0" baseItem="0" subtotal="' << @subtotal << '"/>' end str << '' end -- cgit v1.2.3