Sha256: bf6ef657cc252baab2acc234a88e87d6db4a190fc9465becbe10733aca0250bf
Contents?: true
Size: 1.03 KB
Versions: 1
Compression:
Stored size: 1.03 KB
Contents
require_relative 'paragraph/paragraph_properties' require_relative 'paragraph/paragraph_run' require_relative 'paragraph/text_field' module OoxmlParser class Paragraph attr_accessor :properties, :runs, :text_field, :formulas def initialize(runs = [], formulas = []) @runs = runs @formulas = formulas @runs = [] end alias characters runs alias character_style_array runs alias characters= runs= alias character_style_array= runs= def self.parse(paragraph_node) paragraph = Paragraph.new paragraph_node.xpath('*').each do |paragraph_node_child| case paragraph_node_child.name when 'pPr' paragraph.properties = ParagraphProperties.parse(paragraph_node_child) when 'fld' paragraph.text_field = TextField.parse(paragraph_node_child) when 'r' paragraph.characters << ParagraphRun.parse(paragraph_node_child) when 'm' # TODO: add parsing formulas in paragraph end end paragraph end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ooxml_parser-0.1.2 | lib/ooxml_parser/common_parser/common_data/paragraph.rb |