class OoxmlParser::ExcelComments

All Comments of single XLSX

Attributes

authors[RW]
comment_list[R]

@return [CommentList] list of comments

Public Class Methods

new(parent: nil) click to toggle source
Calls superclass method OoxmlParser::OOXMLDocumentObject::new
# File lib/ooxml_parser/xlsx_parser/workbook/worksheet/excel_comments.rb, line 13
def initialize(parent: nil)
  @authors = []
  @comment_list = []
  super
end

Public Instance Methods

comments() click to toggle source

@return [Array<ExcelComment>] list of comments

# File lib/ooxml_parser/xlsx_parser/workbook/worksheet/excel_comments.rb, line 20
def comments
  comment_list.comments
end
parse(file) click to toggle source

Parse file with ExcelComments @param file [String] file to parse @return [ExcelComments] object with data

# File lib/ooxml_parser/xlsx_parser/workbook/worksheet/excel_comments.rb, line 30
def parse(file)
  doc = parse_xml(file)
  node = doc.xpath('*').first
  node.xpath('*').each do |node_child|
    case node_child.name
    when 'authors'
      @authors << Author.new(parent: self).parse(node_child)
    when 'commentList'
      @comment_list = CommentList.new(parent: self).parse(node_child)
    end
  end
  self
end