From 395e321a5f50908790f31c0400e91a35b0313c66 Mon Sep 17 00:00:00 2001 From: Alexey lexxor Korchagin Date: Fri, 27 Mar 2015 01:36:20 +0700 Subject: [PATCH 1/3] make comments work in office for mac 2015 --- lib/axlsx/workbook/worksheet/comment.rb | 8 ++--- lib/schema/sml.xsd | 41 +++++++++++++++---------- 2 files changed, 28 insertions(+), 21 deletions(-) diff --git a/lib/axlsx/workbook/worksheet/comment.rb b/lib/axlsx/workbook/worksheet/comment.rb index e5dbe41c..99cb3ca9 100644 --- a/lib/axlsx/workbook/worksheet/comment.rb +++ b/lib/axlsx/workbook/worksheet/comment.rb @@ -66,11 +66,11 @@ def to_xml_string(str = "") str << '' unless author.to_s == "" str << '' - str << ("" << ::CGI.escapeHTML(author.to_s) << ":\n") + str << ('' << ::CGI.escapeHTML(author.to_s) << ":\n") end str << '' str << '' - str << ('' << ::CGI.escapeHTML(text) << '') + str << ('' << ::CGI.escapeHTML(text) << '') str << '' end @@ -82,9 +82,9 @@ def initialize_vml_shape pos = Axlsx::name_to_indices(ref) @vml_shape = VmlShape.new(:row => pos[1], :column => pos[0], :visible => @visible) do |vml| vml.left_column = vml.column - vml.right_column = vml.column + 2 + vml.right_column = vml.column + 2 vml.top_row = vml.row - vml.bottom_row = vml.row + 4 + vml.bottom_row = vml.row + 4 end end end diff --git a/lib/schema/sml.xsd b/lib/schema/sml.xsd index 3a67d0f2..294959e1 100644 --- a/lib/schema/sml.xsd +++ b/lib/schema/sml.xsd @@ -10,11 +10,11 @@ schemaLocation="shared-relationshipReference.xsd"/> - - - + + @@ -1799,7 +1799,7 @@ - + @@ -1827,7 +1827,7 @@ - + @@ -1851,12 +1851,19 @@ - + + + + + + + + @@ -2216,7 +2223,7 @@ - + @@ -3776,7 +3783,7 @@ - + @@ -3791,15 +3798,15 @@ - - - - - - - - - + + + + + + + + + From 1adf8ebe0abf4c72892889075a529d568600e127 Mon Sep 17 00:00:00 2001 From: Alexey lexxor Korchagin Date: Fri, 27 Mar 2015 15:28:53 +0700 Subject: [PATCH 2/3] remove excess attribute --- lib/axlsx/workbook/worksheet/comment.rb | 2 +- lib/schema/sml.xsd | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/axlsx/workbook/worksheet/comment.rb b/lib/axlsx/workbook/worksheet/comment.rb index 99cb3ca9..1c5e220c 100644 --- a/lib/axlsx/workbook/worksheet/comment.rb +++ b/lib/axlsx/workbook/worksheet/comment.rb @@ -66,7 +66,7 @@ def to_xml_string(str = "") str << '' unless author.to_s == "" str << '' - str << ('' << ::CGI.escapeHTML(author.to_s) << ":\n") + str << ('' << ::CGI.escapeHTML(author.to_s) << ":\n") end str << '' str << '' diff --git a/lib/schema/sml.xsd b/lib/schema/sml.xsd index 294959e1..71726af9 100644 --- a/lib/schema/sml.xsd +++ b/lib/schema/sml.xsd @@ -1851,7 +1851,7 @@ - + From 9eccf0173931677046ad447058f70da8ae703771 Mon Sep 17 00:00:00 2001 From: Alexey lexxor Korchagin Date: Fri, 27 Mar 2015 15:41:32 +0700 Subject: [PATCH 3/3] specs for xml:space attribute --- test/workbook/worksheet/tc_comment.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/test/workbook/worksheet/tc_comment.rb b/test/workbook/worksheet/tc_comment.rb index e66abb9a..4d4eabe4 100644 --- a/test/workbook/worksheet/tc_comment.rb +++ b/test/workbook/worksheet/tc_comment.rb @@ -55,6 +55,7 @@ def test_to_xml_string assert_equal(doc.xpath("//comment[@authorId='#{@c1.author_index.to_s}']").size, 1) assert_equal(doc.xpath("//t[text()='#{@c1.author}:\n']").size, 1) assert_equal(doc.xpath("//t[text()='#{@c1.text}']").size, 1) + assert_equal(doc.xpath("//t[text()='#{@c1.text}'][@xml:space='preserve']").size, 1) end def test_comment_text_contain_author_and_text