Class: OoxmlParser::PageMargins
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::PageMargins
- Defined in:
- lib/ooxml_parser/docx_parser/docx_data/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) ⇒ PageMargins
Parse BordersProperties.
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(params) ⇒ PageMargins
Returns a new instance of PageMargins.
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_margins.rb', line 6 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] end |
Instance Attribute Details
#bottom ⇒ Object
Returns the value of attribute bottom.
4 5 6 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_margins.rb', line 4 def bottom @bottom end |
#footer ⇒ Object
Returns the value of attribute footer.
4 5 6 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_margins.rb', line 4 def @footer end |
#gutter ⇒ Object
Returns the value of attribute gutter.
4 5 6 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_margins.rb', line 4 def gutter @gutter end |
#header ⇒ Object
Returns the value of attribute header.
4 5 6 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_margins.rb', line 4 def header @header end |
#left ⇒ Object
Returns the value of attribute left.
4 5 6 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_margins.rb', line 4 def left @left end |
#right ⇒ Object
Returns the value of attribute right.
4 5 6 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_margins.rb', line 4 def right @right end |
#top ⇒ Object
Returns the value of attribute top.
4 5 6 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_margins.rb', line 4 def top @top end |
Instance Method Details
#parse(node) ⇒ PageMargins
Parse BordersProperties
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_margins.rb', line 20 def parse(node) node.attributes.each do |key, value| case key when 'top' @top = OoxmlSize.new(value.value.to_f) when 'left' @left = OoxmlSize.new(value.value.to_f) when 'right' @right = OoxmlSize.new(value.value.to_f) when 'bottom' @bottom = OoxmlSize.new(value.value.to_f) when 'header' @header = OoxmlSize.new(value.value.to_f) when 'footer' @footer = OoxmlSize.new(value.value.to_f) when 'gutter' @gutter = OoxmlSize.new(value.value.to_f) end end self end |