Class: OoxmlParser::ExcelComments

Inherits:
OOXMLDocumentObject show all
Extended by:
Gem::Deprecate
Defined in:
lib/ooxml_parser/xlsx_parser/workbook/worksheet/excel_comments.rb

Overview

All Comments of single XLSX

Instance Attribute Summary collapse

Attributes inherited from OOXMLDocumentObject

#parent

Instance Method Summary collapse

Methods inherited from OOXMLDocumentObject

#==, #boolean_attribute_value, #parse_xml, #with_data?

Methods included from OoxmlObjectAttributeHelper

#attribute_enabled?, #option_enabled?

Methods included from OoxmlDocumentObjectHelper

#to_hash

Constructor Details

#initialize(parent: nil) ⇒ ExcelComments

Returns a new instance of ExcelComments.



13
14
15
16
17
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/excel_comments.rb', line 13

def initialize(parent: nil)
  @authors = []
  @comment_list = []
  super
end

Instance Attribute Details

#authorsObject

Returns the value of attribute authors.



9
10
11
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/excel_comments.rb', line 9

def authors
  @authors
end

#comment_listCommentList (readonly)

Returns list of comments.

Returns:



11
12
13
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/excel_comments.rb', line 11

def comment_list
  @comment_list
end

Instance Method Details

#commentsArray<ExcelComment>

Returns list of comments.

Returns:



20
21
22
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/excel_comments.rb', line 20

def comments
  comment_list.comments
end

#parse(file) ⇒ ExcelComments

Parse file with ExcelComments

Parameters:

  • file (String)

    file to parse

Returns:



30
31
32
33
34
35
36
37
38
39
40
41
42
# 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