lib/write_xlsx/worksheet.rb in write_xlsx-0.72.3.beta1 vs lib/write_xlsx/worksheet.rb in write_xlsx-0.73.0
- old
+ new
@@ -4211,15 +4211,11 @@
# limited to numerical formats. Overriding other table formatting may
# produce inconsistent results.
#
def add_table(*args)
# Table count is a member of Workbook, global to all Worksheet.
- @workbook.table_count += 1
- id = @workbook.table_count
- table = Package::Table.new(self, id, *args)
-
- @external_table_links << ['/table', "../tables/table#{id}.xml"]
+ table = Package::Table.new(self, *args)
@tables << table
table
end
#
@@ -5742,9 +5738,26 @@
(1 .. num_comments_block).each do |i|
vml_data_id = "#{vml_data_id},#{vml_data_id + i}"
end
@vml_data_id = vml_data_id
@vml_shape_id = vml_shape_id
+ end
+
+ #
+ # Set the table ids for the worksheet tables.
+ #
+ def prepare_tables(table_id)
+ if tables_count > 0
+ id = table_id
+ tables.each do |table|
+ table.prepare(id)
+
+ # Store the link used for the rels file.
+ @external_table_links << ['/table', "../tables/table#{id}.xml"]
+ id += 1
+ end
+ end
+ tables_count || 0
end
def num_comments_block
@comments.size / 1024
end