From 979523372fb05a7c3da574759a13e82a491bf94f Mon Sep 17 00:00:00 2001 From: Randy Morgan Date: Tue, 4 Dec 2012 09:53:38 +0900 Subject: Moved defined names in workbook to be serialized before pivot tables This fixes https://github.com/randym/axlsx/issues/150 --- lib/axlsx/workbook/workbook.rb | 2 +- test/tc_package.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/axlsx/workbook/workbook.rb b/lib/axlsx/workbook/workbook.rb index c1d304a4..54dd9df1 100644 --- a/lib/axlsx/workbook/workbook.rb +++ b/lib/axlsx/workbook/workbook.rb @@ -313,6 +313,7 @@ require 'axlsx/workbook/worksheet/selection.rb' end end str << '' + defined_names.to_xml_string(str) unless pivot_tables.empty? str << '' pivot_tables.each_with_index do |pivot_table, index| @@ -321,7 +322,6 @@ require 'axlsx/workbook/worksheet/selection.rb' end str << '' end - defined_names.to_xml_string(str) str << '' end diff --git a/test/tc_package.rb b/test/tc_package.rb index bc683575..be303419 100644 --- a/test/tc_package.rb +++ b/test/tc_package.rb @@ -9,7 +9,7 @@ class TestPackage < Test::Unit::TestCase ws.add_row ['Yes!', 'We', 'can!'] ws.add_hyperlink :ref => ws.rows.first.cells.last, :location => 'https://github.com/randym' # TODO this needs to be confirmed and checked. Validation errors should not be happening here!!!!!! - #ws.workbook.add_defined_name("#{ws.name}!A1:C2", :name => '_xlnm.Print_Titles', :hidden => true) + ws.workbook.add_defined_name("#{ws.name}!A1:C2", :name => '_xlnm.Print_Titles', :hidden => true) ws.protect_range('A1:C1') ws.protect_range(ws.rows.last.cells) ws.add_comment :author => 'alice', :text => 'Hi Bob', :ref => 'A12' -- cgit v1.2.3