summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRandy Morgan <[email protected]>2012-12-04 09:53:38 +0900
committerRandy Morgan <[email protected]>2012-12-04 09:53:38 +0900
commit979523372fb05a7c3da574759a13e82a491bf94f (patch)
tree56f6fa524614544b95194a74d8cb8f3e19211276
parent4fd9cc1cdeaec83643e1044d4f1f62f6d6c14d87 (diff)
downloadcaxlsx-979523372fb05a7c3da574759a13e82a491bf94f.tar.gz
caxlsx-979523372fb05a7c3da574759a13e82a491bf94f.zip
Moved defined names in workbook to be serialized before pivot tables
This fixes https://github.com/randym/axlsx/issues/150
-rw-r--r--lib/axlsx/workbook/workbook.rb2
-rw-r--r--test/tc_package.rb2
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 << '</sheets>'
+ defined_names.to_xml_string(str)
unless pivot_tables.empty?
str << '<pivotCaches>'
pivot_tables.each_with_index do |pivot_table, index|
@@ -321,7 +322,6 @@ require 'axlsx/workbook/worksheet/selection.rb'
end
str << '</pivotCaches>'
end
- defined_names.to_xml_string(str)
str << '</workbook>'
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'