Class: OoxmlParser::PageMargins
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::PageMargins
- Defined in:
- lib/ooxml_parser/docx_parser/document_structure/page_properties/page_margins.rb
Overview
Class for parsing ‘pgMar` tags
Instance Attribute Summary collapse
-
#bottom ⇒ Object
Returns the value of attribute bottom.
-
#footer ⇒ Object
Returns the value of attribute footer.
-
#gutter ⇒ Object
Returns the value of attribute gutter.
-
#header ⇒ Object
Returns the value of attribute header.
-
#left ⇒ Object
Returns the value of attribute left.
-
#right ⇒ Object
Returns the value of attribute right.
-
#top ⇒ Object
Returns the value of attribute top.
Attributes inherited from OOXMLDocumentObject
Instance Method Summary collapse
-
#initialize(params) ⇒ PageMargins
constructor
A new instance of PageMargins.
-
#parse(node, unit = :dxa) ⇒ PageMargins
Parse BordersProperties.
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(params) ⇒ PageMargins
Returns a new instance of PageMargins.
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/ooxml_parser/docx_parser/document_structure/page_properties/page_margins.rb', line 8 def initialize(params) @top = params[:top] @bottom = params[:bottom] @left = params[:left] @right = params[:right] @header = params[:header] @footer = params[:footer] @gutter = params[:gutter] @parent = params[:parent] super(parent: nil) end |
Instance Attribute Details
#bottom ⇒ Object
Returns the value of attribute bottom.
6 7 8 |
# File 'lib/ooxml_parser/docx_parser/document_structure/page_properties/page_margins.rb', line 6 def bottom @bottom end |
#footer ⇒ Object
Returns the value of attribute footer.
6 7 8 |
# File 'lib/ooxml_parser/docx_parser/document_structure/page_properties/page_margins.rb', line 6 def @footer end |
#gutter ⇒ Object
Returns the value of attribute gutter.
6 7 8 |
# File 'lib/ooxml_parser/docx_parser/document_structure/page_properties/page_margins.rb', line 6 def gutter @gutter end |
#header ⇒ Object
Returns the value of attribute header.
6 7 8 |
# File 'lib/ooxml_parser/docx_parser/document_structure/page_properties/page_margins.rb', line 6 def header @header end |
#left ⇒ Object
Returns the value of attribute left.
6 7 8 |
# File 'lib/ooxml_parser/docx_parser/document_structure/page_properties/page_margins.rb', line 6 def left @left end |
#right ⇒ Object
Returns the value of attribute right.
6 7 8 |
# File 'lib/ooxml_parser/docx_parser/document_structure/page_properties/page_margins.rb', line 6 def right @right end |
#top ⇒ Object
Returns the value of attribute top.
6 7 8 |
# File 'lib/ooxml_parser/docx_parser/document_structure/page_properties/page_margins.rb', line 6 def top @top end |
Instance Method Details
#parse(node, unit = :dxa) ⇒ PageMargins
Parse BordersProperties
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/ooxml_parser/docx_parser/document_structure/page_properties/page_margins.rb', line 23 def parse(node, unit = :dxa) node.attributes.each do |key, value| case key when 'top' @top = OoxmlSize.new(value.value.to_f, unit) when 'left' @left = OoxmlSize.new(value.value.to_f, unit) when 'right' @right = OoxmlSize.new(value.value.to_f, unit) when 'bottom' @bottom = OoxmlSize.new(value.value.to_f, unit) when 'header' @header = OoxmlSize.new(value.value.to_f, unit) when 'footer' @footer = OoxmlSize.new(value.value.to_f, unit) when 'gutter' @gutter = OoxmlSize.new(value.value.to_f, unit) end end self end |