Class: OoxmlParser::Paragraph
- Inherits:
-
Object
- Object
- OoxmlParser::Paragraph
- Defined in:
- lib/ooxml_parser/common_parser/common_data/paragraph.rb
Instance Attribute Summary collapse
-
#formulas ⇒ Object
Returns the value of attribute formulas.
-
#properties ⇒ Object
Returns the value of attribute properties.
-
#runs ⇒ Object
(also: #characters, #character_style_array)
Returns the value of attribute runs.
-
#text_field ⇒ Object
Returns the value of attribute text_field.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(runs = [], formulas = []) ⇒ Paragraph
constructor
A new instance of Paragraph.
Constructor Details
#initialize(runs = [], formulas = []) ⇒ Paragraph
Returns a new instance of Paragraph.
8 9 10 11 12 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph.rb', line 8 def initialize(runs = [], formulas = []) @runs = runs @formulas = formulas @runs = [] end |
Instance Attribute Details
#formulas ⇒ Object
Returns the value of attribute formulas.
6 7 8 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph.rb', line 6 def formulas @formulas end |
#properties ⇒ Object
Returns the value of attribute properties.
6 7 8 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph.rb', line 6 def properties @properties end |
#runs ⇒ Object Also known as: characters, character_style_array
Returns the value of attribute runs.
6 7 8 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph.rb', line 6 def runs @runs end |
#text_field ⇒ Object
Returns the value of attribute text_field.
6 7 8 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph.rb', line 6 def text_field @text_field end |
Class Method Details
.parse(paragraph_node) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph.rb', line 19 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 |