Module: OoxmlParser::DefaultStyleHelper
- Included in:
- DocumentStructure
- Defined in:
- lib/ooxml_parser/docx_parser/document_structure/default_style_helper.rb
Overview
Helper methods for parsing default style
Instance Method Summary collapse
-
#parse_default_style ⇒ void
Parse default style.
-
#parse_styles ⇒ Object
Perform parsing styles.xml.
Instance Method Details
#parse_default_style ⇒ void
This method returns an undefined value.
Parse default style
8 9 10 11 12 13 14 15 16 |
# File 'lib/ooxml_parser/docx_parser/document_structure/default_style_helper.rb', line 8 def parse_default_style parse_default_style_paragraph_properties parse_default_style_run_properties parse_default_character_style root_object.default_table_paragraph_style = root_object.default_paragraph_style.dup root_object.default_table_paragraph_style.spacing = Spacing.new(0, 0, 1, :auto) root_object.default_table_run_style = root_object.default_run_style.dup parse_default_table_style end |
#parse_styles ⇒ Object
Perform parsing styles.xml
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/ooxml_parser/docx_parser/document_structure/default_style_helper.rb', line 19 def parse_styles file = "#{root_object.unpacked_folder}/word/styles.xml" root_object.default_paragraph_style = DocxParagraph.new(parent: self) root_object.default_table_paragraph_style = DocxParagraph.new(parent: self) root_object.default_run_style = DocxParagraphRun.new(parent: self) root_object.default_table_run_style = DocxParagraphRun.new(parent: self) return unless File.exist?(file) @styles = Styles.new(parent: self).parse @numbering = Numbering.new(parent: self).parse if @styles&.document_defaults&.paragraph_properties_default root_object.default_paragraph_style = DocxParagraph.new(parent: self) .parse(@styles.document_defaults .paragraph_properties_default .raw_node, 0) end if @styles&.document_defaults&.run_properties_default&.run_properties root_object.default_run_style = DocxParagraphRun.new(parent: self) .parse_properties(@styles .document_defaults .run_properties_default .run_properties .raw_node) end parse_default_style end |