Sha256: bb132d11bb790ae4ce82132d3f72e68a21bb85498d4732d58512ac4b2b10b393
Contents?: true
Size: 889 Bytes
Versions: 2
Compression:
Stored size: 889 Bytes
Contents
# Comment Data module OoxmlParser class Comment < OOXMLDocumentObject attr_accessor :id, :paragraphs def initialize(id = nil, paragraphs = []) @id = id @paragraphs = paragraphs end def self.parse_list comments = [] comments_filename = "#{OOXMLDocumentObject.path_to_folder}/#{OOXMLDocumentObject.root_subfolder}/comments.xml" return [] unless File.exist?(comments_filename) doc = Nokogiri::XML(File.open(comments_filename)) doc.search('//w:comments').each do |document| document.xpath('w:comment').each do |comment_tag| comment = Comment.new(comment_tag.attribute('id').value) comment_tag.xpath('w:p').each_with_index do |p, index| comment.paragraphs << DocxParagraph.parse(p, index) end comments << comment.dup end end comments end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ooxml_parser-0.1.2 | lib/ooxml_parser/docx_parser/docx_data/document_structure/comment.rb |
ooxml_parser-0.1.1 | lib/ooxml_parser/docx_parser/docx_data/document_structure/comment.rb |