Class: Axlsx::Comment
- Inherits:
-
Object
- Object
- Axlsx::Comment
- Includes:
- OptionsParser
- 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
Creates a new comment object.
-
#to_xml_string(str = "") ⇒ String
serialize the object.
-
#vml_shape ⇒ VmlShape
The vml shape that will render this comment.
Methods included from OptionsParser
Constructor Details
#initialize(comments, options = {}) {|_self| ... } ⇒ Comment
Creates a new comment object
13 14 15 16 17 18 |
# File 'lib/axlsx/workbook/worksheet/comment.rb', line 13 def initialize(comments, ={}) raise ArgumentError, "A comment needs a parent comments object" unless comments.is_a?(Comments) @comments = comments yield self if block_given? end |
Instance Attribute Details
#author ⇒ String
The author of this comment
27 28 29 |
# File 'lib/axlsx/workbook/worksheet/comment.rb', line 27 def @author end |
#comments ⇒ Comments (readonly)
The owning Comments object
31 32 33 |
# File 'lib/axlsx/workbook/worksheet/comment.rb', line 31 def comments @comments end |
#ref ⇒ String
The string based cell position reference (e.g. 'A1') that determines the positioning of this comment
36 37 38 |
# File 'lib/axlsx/workbook/worksheet/comment.rb', line 36 def ref @ref end |
#text ⇒ String
The text to render
22 23 24 |
# File 'lib/axlsx/workbook/worksheet/comment.rb', line 22 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.
52 53 54 |
# File 'lib/axlsx/workbook/worksheet/comment.rb', line 52 def @comments..index() end |
#to_xml_string(str = "") ⇒ String
serialize the object
77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/axlsx/workbook/worksheet/comment.rb', line 77 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
45 46 47 |
# File 'lib/axlsx/workbook/worksheet/comment.rb', line 45 def vml_shape @vml_shape ||= initialize_vml_shape end |