Sha256: 12c2168a21c9dfffa3669132ce4a052acac905086a15080708dde123461bbc55

Contents?: true

Size: 806 Bytes

Versions: 8

Compression:

Stored size: 806 Bytes

Contents

# frozen_string_literal: true

module OoxmlParser
  # Single Comment of XLSX
  class ExcelComment < OOXMLDocumentObject
    attr_accessor :characters
    # @return [String] text of comment
    attr_reader :text

    def initialize(parent: nil)
      @characters = []
      @parent = parent
    end

    # Parse ExcelComment object
    # @param node [Nokogiri::XML:Element] node to parse
    # @return [ExcelComment] result of parsing
    def parse(node)
      node.xpath('xmlns:text/xmlns:r').each do |node_child|
        @characters << ParagraphRun.new(parent: self).parse(node_child)
      end
      node.xpath('xmlns:text/*').each do |node_child|
        case node_child.name
        when 't'
          @text = Text.new(parent: self).parse(node_child)
        end
      end
      self
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ooxml_parser-0.8.1 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments/excel_comment.rb
ooxml_parser-0.8.0 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments/excel_comment.rb
ooxml_parser-0.7.2 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments/excel_comment.rb
ooxml_parser-0.7.1 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments/excel_comment.rb
ooxml_parser-0.7.0 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments/excel_comment.rb
ooxml_parser-0.6.0 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments/excel_comment.rb
ooxml_parser-0.5.1 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments/excel_comment.rb
ooxml_parser-0.5.0 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments/excel_comment.rb