Class: OoxmlParser::ParagraphProperties
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::ParagraphProperties
- Defined in:
- lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb
Instance Attribute Summary collapse
-
#align ⇒ Object
Returns the value of attribute align.
-
#contextual_spacing ⇒ True, False
before or after this paragraph, specified using the spacing element (17.3.1.33), should not be applied when the preceding and following paragraphs are of the same paragraph style, affecting the top and bottom spacing respectively.
-
#frame_properties ⇒ FrameProperties
readonly
Frame properties.
-
#indent ⇒ Object
Returns the value of attribute indent.
-
#justification ⇒ Symbol
The alignment or justification to be applied to a paragraph.
-
#keep_next ⇒ True, False
(or at least part of it) should be rendered on the same page as the next paragraph when possible.
-
#level ⇒ Object
Returns the value of attribute level.
-
#margin_left ⇒ Object
Returns the value of attribute margin_left.
-
#margin_right ⇒ Object
Returns the value of attribute margin_right.
-
#numbering ⇒ Object
Returns the value of attribute numbering.
-
#paragraph_borders ⇒ Borders
Borders of paragraph.
-
#run_properties ⇒ RunProperties
Properties of run.
-
#section_properties ⇒ PageProperties
Properties of section.
-
#spacing ⇒ Object
Returns the value of attribute spacing.
-
#spacing_after ⇒ Object
Returns the value of attribute spacing_after.
-
#spacing_before ⇒ Object
Returns the value of attribute spacing_before.
-
#tabs ⇒ Tabs
List of tabs.
Attributes inherited from OOXMLDocumentObject
Instance Method Summary collapse
-
#initialize(numbering = NumberingProperties.new, parent: nil) ⇒ ParagraphProperties
constructor
A new instance of ParagraphProperties.
-
#parse(node) ⇒ ParagraphProperties
Parse ParagraphProperties object.
Methods inherited from OOXMLDocumentObject
#==, add_to_xmls_stack, copy_file_and_rename_to_zip, current_xml, dir, encrypted_file?, get_link_from_rels, unzip_file, #with_data?
Methods included from OoxmlDocumentObjectHelper
Constructor Details
#initialize(numbering = NumberingProperties.new, parent: nil) ⇒ ParagraphProperties
Returns a new instance of ParagraphProperties.
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb', line 31 def initialize(numbering = NumberingProperties.new, parent: nil) @numbering = numbering @spacing = Spacing.new(OoxmlSize.new(0), OoxmlSize.new(0), OoxmlSize.new(1, :centimeter), :multiple) @keep_next = false @tabs = [] @parent = parent end |
Instance Attribute Details
#align ⇒ Object
Returns the value of attribute align.
8 9 10 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb', line 8 def align @align end |
#contextual_spacing ⇒ True, False
before or after this paragraph, specified using the spacing element (17.3.1.33), should not be applied when the preceding and following paragraphs are of the same paragraph style, affecting the top and bottom spacing respectively
27 28 29 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb', line 27 def contextual_spacing @contextual_spacing end |
#frame_properties ⇒ FrameProperties (readonly)
Returns frame properties.
10 11 12 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb', line 10 def frame_properties @frame_properties end |
#indent ⇒ Object
Returns the value of attribute indent.
8 9 10 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb', line 8 def indent @indent end |
#justification ⇒ Symbol
Returns The alignment or justification to be applied to a paragraph.
29 30 31 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb', line 29 def justification @justification end |
#keep_next ⇒ True, False
(or at least part of it) should be rendered on the same page as the next paragraph when possible
20 21 22 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb', line 20 def keep_next @keep_next end |
#level ⇒ Object
Returns the value of attribute level.
8 9 10 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb', line 8 def level @level end |
#margin_left ⇒ Object
Returns the value of attribute margin_left.
8 9 10 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb', line 8 def margin_left @margin_left end |
#margin_right ⇒ Object
Returns the value of attribute margin_right.
8 9 10 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb', line 8 def margin_right @margin_right end |
#numbering ⇒ Object
Returns the value of attribute numbering.
8 9 10 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb', line 8 def numbering @numbering end |
#paragraph_borders ⇒ Borders
Returns borders of paragraph.
16 17 18 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb', line 16 def paragraph_borders @paragraph_borders end |
#run_properties ⇒ RunProperties
Returns properties of run.
14 15 16 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb', line 14 def run_properties @run_properties end |
#section_properties ⇒ PageProperties
Returns properties of section.
22 23 24 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb', line 22 def section_properties @section_properties end |
#spacing ⇒ Object
Returns the value of attribute spacing.
8 9 10 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb', line 8 def spacing @spacing end |
#spacing_after ⇒ Object
Returns the value of attribute spacing_after.
8 9 10 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb', line 8 def spacing_after @spacing_after end |
#spacing_before ⇒ Object
Returns the value of attribute spacing_before.
8 9 10 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb', line 8 def spacing_before @spacing_before end |
#tabs ⇒ Tabs
Returns list of tabs.
12 13 14 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb', line 12 def tabs @tabs end |
Instance Method Details
#parse(node) ⇒ ParagraphProperties
Parse ParagraphProperties object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb', line 45 def parse(node) @spacing.parse(node) node.attributes.each do |key, value| case key when 'algn' @align = value_to_symbol(value) when 'lvl' @level = value.value.to_i when 'indent' @indent = OoxmlSize.new(value.value.to_f, :emu) when 'marR' @margin_right = OoxmlSize.new(value.value.to_f, :emu) when 'marL' @margin_left = OoxmlSize.new(value.value.to_f, :emu) end end node.xpath('*').each do |node_child| case node_child.name when 'buSzPct' @numbering.size = node_child.attribute('val').value when 'buFont' @numbering.font = node_child.attribute('typeface').value when 'buChar' @numbering.symbol = node_child.attribute('char').value when 'buAutoNum' @numbering.type = node_child.attribute('type').value.to_sym @numbering.start_at = node_child.attribute('startAt').value if node_child.attribute('startAt') when 'framePr' @frame_properties = FrameProperties.new(parent: self).parse(node_child) when 'tabs' @tabs = Tabs.new(parent: self).parse(node_child) when 'tabLst' @tabs = Tabs.new(parent: self).parse(node_child) when 'ind' @indent = Indents.new(parent: self).parse(node_child) when 'rPr' @run_properties = RunProperties.new(parent: self).parse(node_child) when 'pBdr' @paragraph_borders = ParagraphBorders.new(parent: self).parse(node_child) when 'keepNext' @keep_next = true when 'sectPr' @section_properties = PageProperties.new(parent: self).parse(node_child, @parent, DocxParagraphRun.new) when 'spacing' @spacing = ParagraphSpacing.new(parent: self).parse(node_child) when 'jc' @justification = value_to_symbol(node_child.attribute('val')) when 'contextualSpacing' @contextual_spacing = option_enabled?(node_child) end end self end |