lib/write_xlsx/package/table.rb in write_xlsx-0.65.1 vs lib/write_xlsx/package/table.rb in write_xlsx-0.69.0
- old
+ new
@@ -22,12 +22,10 @@
@format = nil
@user_data = param[id-1] if param
end
end
-# attr_reader :id
-
def initialize(worksheet, id, *args)
@worksheet = worksheet
@writer = Package::XMLWriterSimple.new
@id = id
@@ -202,30 +200,20 @@
end
def handle_the_column_formula(col_data, col_num, formula, format)
return unless formula
- # Remove the leading = from formula.
- formula.sub!(/^=/, '')
- # Covert Excel 2010 "@" ref to 2007 "#This Row".
- formula.gsub!(/@/,'[#This Row],')
+ col_data.formula = formula.sub(/^=/, '').gsub(/@/,'[#This Row],')
- col_data.formula = formula
-
(@first_data_row..@last_data_row).each do |row|
- @worksheet.write_formula(row, col_num, formula, format)
+ @worksheet.write_formula(row, col_num, col_data.formula, format)
end
end
def handle_the_function_for_the_table_row(row2, col_data, col_num, total_function, format)
- function = total_function
+ function = total_function.downcase.gsub(/[_\s]/, '')
- # Massage the function name.
- function = function.downcase
- function.gsub!(/_/, '')
- function.gsub!(/\s/,'')
-
function = 'countNums' if function == 'countnums'
function = 'stdDev' if function == 'stddev'
col_data.total_function = function
@@ -270,12 +258,10 @@
@totals_row_shown = ptrue?(@param[:total_row]) ? 1 : 0
end
def set_the_table_style
if @param[:style]
- @style = @param[:style]
- # Remove whitespace from style name.
- @style.gsub!(/\s/, '')
+ @style = @param[:style].gsub(/\s/, '')
else
@style = "TableStyleMedium9"
end
end