Sha256: 2ee04fe8a86bcfabf3d76c2bd31b487800e2fc2ee9cfa5609daa70937d5d2eb2
Contents?: true
Size: 893 Bytes
Versions: 1
Compression:
Stored size: 893 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.new.parse(p, index) end comments << comment.dup end end comments end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ooxml_parser-0.2.0 | lib/ooxml_parser/docx_parser/docx_data/document_structure/comment.rb |