class Axlsx::WorksheetComments
A wraper class for comments that defines its on worksheet serailization
Attributes
worksheet[R]
Public Class Methods
new(worksheet)
click to toggle source
Creates a new WorksheetComments
object param [Worksheet] worksheet The worksheet comments in thes object belong to
# File lib/axlsx/workbook/worksheet/worksheet_comments.rb, line 9 def initialize(worksheet) raise ArugumentError, 'You must provide a worksheet' unless worksheet.is_a?(Worksheet) @worksheet = worksheet end
Public Instance Methods
add_comment(options={})
click to toggle source
Adds a comment @param [Hash] options @see Comments#add_comment
# File lib/axlsx/workbook/worksheet/worksheet_comments.rb, line 25 def add_comment(options={}) comments.add_comment(options) end
comments()
click to toggle source
The comments for this worksheet. @return [Comments]
# File lib/axlsx/workbook/worksheet/worksheet_comments.rb, line 18 def comments @comments ||= Comments.new(worksheet) end
drawing_rId()
click to toggle source
The relationship id of the VML drawing that will render the comments. @see Relationship#Id @return [String]
# File lib/axlsx/workbook/worksheet/worksheet_comments.rb, line 46 def drawing_rId comments.relationships.find{ |r| r.Type == VML_DRAWING_R }.Id end
has_comments?()
click to toggle source
Helper method to tell us if there are comments in the comments collection @return [Boolean]
# File lib/axlsx/workbook/worksheet/worksheet_comments.rb, line 39 def has_comments? !comments.empty? end
relationships()
click to toggle source
The relationships defined by this objects comments collection @return [Relationships]
# File lib/axlsx/workbook/worksheet/worksheet_comments.rb, line 31 def relationships return [] unless has_comments? comments.relationships end
to_xml_string(str = '')
click to toggle source
Seraalize the object @param [String] str @return [String]
# File lib/axlsx/workbook/worksheet/worksheet_comments.rb, line 53 def to_xml_string(str = '') return unless has_comments? str << "<legacyDrawing r:id='#{drawing_rId}' />" end