summaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
authorStefan Daschek <[email protected]>2013-07-03 16:49:34 +0200
committerStefan Daschek <[email protected]>2013-07-03 16:49:34 +0200
commita60d1889744205dbc86ce0e23f8ed04ba7093d23 (patch)
tree4ff6990a0c95a0ce1f7307466c1ae54e40349a7a /lib
parent7bb62e8870ae369a9b2423c87d5e0875873c3834 (diff)
downloadcaxlsx-a60d1889744205dbc86ce0e23f8ed04ba7093d23.tar.gz
caxlsx-a60d1889744205dbc86ce0e23f8ed04ba7093d23.zip
Do not start comment text with stray colon if author is blank
Diffstat (limited to 'lib')
-rw-r--r--lib/axlsx/workbook/worksheet/comment.rb9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/axlsx/workbook/worksheet/comment.rb b/lib/axlsx/workbook/worksheet/comment.rb
index eee2b58a..7035f4cf 100644
--- a/lib/axlsx/workbook/worksheet/comment.rb
+++ b/lib/axlsx/workbook/worksheet/comment.rb
@@ -64,10 +64,11 @@ module Axlsx
def to_xml_string(str = "")
author = @comments.authors[author_index]
str << '<comment ref="' << ref << '" authorId="' << author_index.to_s << '">'
- str << '<text><r>'
- str << '<rPr> <b/><color indexed="81"/></rPr>'
- str << '<t>' << ::CGI.escapeHTML(author.to_s) << ':
-</t></r>'
+ str << '<text>'
+ unless author.to_s == ""
+ str << '<r><rPr><b/><color indexed="81"/></rPr>'
+ str << "<t>" << ::CGI.escapeHTML(author.to_s) << ":\n</t></r>"
+ end
str << '<r>'
str << '<rPr><color indexed="81"/></rPr>'
str << '<t>' << ::CGI.escapeHTML(text) << '</t></r></text>'