Class: Axlsx::Comment
- Inherits:
-
Object
- Object
- Axlsx::Comment
- Defined in:
- lib/axlsx/workbook/worksheet/comment.rb
Overview
A comment is the text data for a comment
Instance Attribute Summary collapse
-
#author ⇒ String
The author of this comment.
-
#comments ⇒ Comments
readonly
The owning Comments object.
-
#ref ⇒ String
The string based cell position reference (e.g. 'A1') that determines the positioning of this comment.
-
#text ⇒ String
The text to render.
Instance Method Summary collapse
-
#author_index ⇒ Integer
The index of this author in a unique sorted list of all authors in the comment.
-
#initialize(comments, options = {}) {|_self| ... } ⇒ Comment
constructor
TODO r (Rich Text Run) rPh (Phonetic Text Run) phoneticPr (Phonetic Properties).
-
#to_xml_string(str = "") ⇒ String
serialize the object.
-
#vml_shape ⇒ VmlShape
The vml shape that will render this comment.
Constructor Details
#initialize(comments, options = {}) {|_self| ... } ⇒ Comment
TODO r (Rich Text Run) rPh (Phonetic Text Run) phoneticPr (Phonetic Properties)
29 30 31 32 33 34 35 36 |
# File 'lib/axlsx/workbook/worksheet/comment.rb', line 29 def initialize(comments, ={}) raise ArgumentError, "A comment needs a parent comments object" unless comments.is_a?(Comments) @comments = comments .each do |o| self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}=" end yield self if block_given? end |
Instance Attribute Details
#author ⇒ String
The author of this comment
13 14 15 |
# File 'lib/axlsx/workbook/worksheet/comment.rb', line 13 def @author end |
#comments ⇒ Comments (readonly)
The owning Comments object
17 18 19 |
# File 'lib/axlsx/workbook/worksheet/comment.rb', line 17 def comments @comments end |
#ref ⇒ String
The string based cell position reference (e.g. 'A1') that determines the positioning of this comment
22 23 24 |
# File 'lib/axlsx/workbook/worksheet/comment.rb', line 22 def ref @ref end |
#text ⇒ String
The text to render
8 9 10 |
# File 'lib/axlsx/workbook/worksheet/comment.rb', line 8 def text @text end |
Instance Method Details
#author_index ⇒ Integer
The index of this author in a unique sorted list of all authors in the comment.
48 49 50 |
# File 'lib/axlsx/workbook/worksheet/comment.rb', line 48 def @comments..index() end |
#to_xml_string(str = "") ⇒ String
serialize the object
73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/axlsx/workbook/worksheet/comment.rb', line 73 def to_xml_string(str = "") = @comments.[] str << '<comment ref="' << ref << '" authorId="' << .to_s << '">' str << '<text><r>' str << '<rPr> <b/><color indexed="81"/></rPr>' str << '<t>' << .to_s << ': </t></r>' str << '<r>' str << '<rPr><color indexed="81"/></rPr>' str << '<t>' << text << '</t></r></text>' str << '</comment>' end |
#vml_shape ⇒ VmlShape
The vml shape that will render this comment
40 41 42 |
# File 'lib/axlsx/workbook/worksheet/comment.rb', line 40 def vml_shape @vml_shape ||= initialize_vml_shape end |