Method: Axlsx::Comment#to_xml_string

Defined in:
lib/axlsx/workbook/worksheet/comment.rb

#to_xml_string(str = "") ⇒ String

serialize the object

Parameters:

  • str (String) (defaults to: "")

Returns:

  • (String)


62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/axlsx/workbook/worksheet/comment.rb', line 62

def to_xml_string(str = "")
  author = @comments.authors[author_index]
  str << ('<comment ref="' << ref << '" authorId="' << author_index.to_s << '">')
  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>')
  str << '</comment>'
end