lib/write_xlsx/workbook.rb in write_xlsx-0.86.0 vs lib/write_xlsx/workbook.rb in write_xlsx-0.87.0

- old
+ new

@@ -724,29 +724,29 @@ sheet_index = -1 # Use -1 to indicate global names. end # Raise if the sheet index wasn't found. if !sheet_index - raise "Unknown sheet name #{sheetname} in defined_name()\n" + raise "Unknown sheet name #{sheetname} in defined_name()" end # Raise if the name contains invalid chars as defined by Excel help. # Refer to the following to see Excel's syntax rules for defined names: # http://office.microsoft.com/en-001/excel-help/define-and-use-names-in-formulas-HA010147120.aspx#BMsyntax_rules_for_names # if name =~ /\A[-0-9 !"#\$%&'\(\)\*\+,\.:;<=>\?@\[\]\^`\{\}~]/ || name =~ /.+[- !"#\$%&'\(\)\*\+,\\:;<=>\?@\[\]\^`\{\}~]/ - raise "Invalid characters in name '#{name}' used in defined_name()\n" + raise "Invalid characters in name '#{name}' used in defined_name()" end # Raise if the name looks like a cell name. if name =~ %r(^[a-zA-Z][a-zA-Z]?[a-dA-D]?[0-9]+$) - raise "Invalid name '#{name}' looks like a cell name in defined_name()\n" + raise "Invalid name '#{name}' looks like a cell name in defined_name()" end # Raise if the name looks like a R1C1 if name =~ /\A[rcRC]\Z/ || name =~ /\A[rcRC]\d+[rcRC]\d+\Z/ - raise "Invalid name '#{name}' like a RC cell ref in defined_name()\n" + raise "Invalid name '#{name}' like a RC cell ref in defined_name()" end @defined_names.push([ name, sheet_index, formula.sub(/^=/, '') ]) end @@ -1631,12 +1631,13 @@ # # Set the table ids for the worksheet tables. # def prepare_tables table_id = 0 + seen = {} sheets.each do |sheet| - table_id += sheet.prepare_tables(table_id + 1) + table_id += sheet.prepare_tables(table_id + 1, seen) end end def add_font_format_for_cell_comments format = Format.new(