Class: OoxmlParser::ParagraphMargins
- Inherits:
-
TableMargins
- Object
- OOXMLDocumentObject
- TableMargins
- OoxmlParser::ParagraphMargins
- Defined in:
- lib/ooxml_parser/common_parser/common_data/table/margins/paragraph_margins.rb
Overview
Class for working with ParagraphMargins
Instance Attribute Summary
Attributes inherited from TableMargins
#bottom, #is_default, #left, #right, #top
Attributes inherited from OOXMLDocumentObject
Instance Method Summary collapse
-
#initialize(top = OoxmlSize.new(0), bottom = OoxmlSize.new(0), left = OoxmlSize.new(0), right = OoxmlSize.new(0), parent: nil) ⇒ ParagraphMargins
constructor
A new instance of ParagraphMargins.
-
#parse(text_body_props_node) ⇒ ParagraphMargins
Parse ParagraphMargins object.
Methods inherited from TableMargins
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(top = OoxmlSize.new(0), bottom = OoxmlSize.new(0), left = OoxmlSize.new(0), right = OoxmlSize.new(0), parent: nil) ⇒ ParagraphMargins
Returns a new instance of ParagraphMargins.
6 7 8 9 10 11 12 |
# File 'lib/ooxml_parser/common_parser/common_data/table/margins/paragraph_margins.rb', line 6 def initialize(top = OoxmlSize.new(0), bottom = OoxmlSize.new(0), left = OoxmlSize.new(0), right = OoxmlSize.new(0), parent: nil) super(true, top, bottom, left, right, parent: parent) end |
Instance Method Details
#parse(text_body_props_node) ⇒ ParagraphMargins
Parse ParagraphMargins object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/ooxml_parser/common_parser/common_data/table/margins/paragraph_margins.rb', line 17 def parse(text_body_props_node) text_body_props_node.attributes.each do |key, value| case key when 'bIns', 'marB' @bottom = OoxmlSize.new(value.value.to_f, :emu) when 'tIns', 'marT' @top = OoxmlSize.new(value.value.to_f, :emu) when 'lIns', 'marL' @left = OoxmlSize.new(value.value.to_f, :emu) when 'rIns', 'marR' @right = OoxmlSize.new(value.value.to_f, :emu) end end self end |