Class: OoxmlParser::ParagraphProperties
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::ParagraphProperties
- Defined in:
- lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb
Overview
Class for data for ParagraphProperties
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.
-
#paragraph_style_ref ⇒ ParagraphStyleRef
Referenced Paragraph Style.
-
#run_properties ⇒ RunProperties
Properties of run.
-
#section_properties ⇒ PageProperties
Properties of section.
-
#shade ⇒ Shade
Shade property.
-
#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
#==, #boolean_attribute_value, #parse_xml, #with_data?
Methods included from OoxmlObjectAttributeHelper
#attribute_enabled?, #option_enabled?
Methods included from OoxmlDocumentObjectHelper
Constructor Details
#initialize(numbering = NumberingProperties.new, parent: nil) ⇒ ParagraphProperties
Returns a new instance of ParagraphProperties.
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb', line 40 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 = [] super(parent: parent) end |
Instance Attribute Details
#align ⇒ Object
Returns the value of attribute align.
13 14 15 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb', line 13 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
34 35 36 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb', line 34 def contextual_spacing @contextual_spacing end |
#frame_properties ⇒ FrameProperties (readonly)
Returns frame properties.
15 16 17 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb', line 15 def frame_properties @frame_properties end |
#indent ⇒ Object
Returns the value of attribute indent.
13 14 15 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb', line 13 def indent @indent end |
#justification ⇒ Symbol
Returns The alignment or justification to be applied to a paragraph.
36 37 38 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb', line 36 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
27 28 29 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb', line 27 def keep_next @keep_next end |
#level ⇒ Object
Returns the value of attribute level.
13 14 15 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb', line 13 def level @level end |
#margin_left ⇒ Object
Returns the value of attribute margin_left.
13 14 15 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb', line 13 def margin_left @margin_left end |
#margin_right ⇒ Object
Returns the value of attribute margin_right.
13 14 15 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb', line 13 def margin_right @margin_right end |
#numbering ⇒ Object
Returns the value of attribute numbering.
13 14 15 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb', line 13 def numbering @numbering end |
#paragraph_borders ⇒ Borders
Returns borders of paragraph.
21 22 23 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb', line 21 def paragraph_borders @paragraph_borders end |
#paragraph_style_ref ⇒ ParagraphStyleRef
Returns Referenced Paragraph Style.
23 24 25 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb', line 23 def paragraph_style_ref @paragraph_style_ref end |
#run_properties ⇒ RunProperties
Returns properties of run.
19 20 21 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb', line 19 def run_properties @run_properties end |
#section_properties ⇒ PageProperties
Returns properties of section.
29 30 31 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb', line 29 def section_properties @section_properties end |
#shade ⇒ Shade
Returns Shade property.
38 39 40 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb', line 38 def shade @shade end |
#spacing ⇒ Object
Returns the value of attribute spacing.
13 14 15 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb', line 13 def spacing @spacing end |
#spacing_after ⇒ Object
Returns the value of attribute spacing_after.
13 14 15 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb', line 13 def spacing_after @spacing_after end |
#spacing_before ⇒ Object
Returns the value of attribute spacing_before.
13 14 15 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb', line 13 def spacing_before @spacing_before end |
#tabs ⇒ Tabs
Returns list of tabs.
17 18 19 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb', line 17 def tabs @tabs end |
Instance Method Details
#parse(node) ⇒ ParagraphProperties
Parse ParagraphProperties object
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 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb', line 54 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 'buBlip' @numbering.image = BulletImage.new(parent: self).parse(node_child) 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', '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 'pStyle' @paragraph_style_ref = ParagraphStyleRef.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 'shd' @shade = Shade.new(parent: self).parse(node_child) when 'spacing' @spacing = ParagraphSpacing.new(parent: self).parse(node_child) when 'jc' @justification_object = ValuedChild.new(:string, parent: self).parse(node_child) @justification = value_to_symbol(@justification_object) when 'contextualSpacing' contextual_spacing_object = ValuedChild.new(:boolean, parent: self).parse(node_child) @contextual_spacing = contextual_spacing_object.value end end self end |