class OoxmlParser::PageMargins
Class for parsing ‘pgMar` tags
Attributes
Public Class Methods
Source
# 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
Calls superclass method
OoxmlParser::OOXMLDocumentObject::new
Public Instance Methods
Source
# 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
Parse BordersProperties
@param [Nokogiri::XML:Element] node with PageMargins
@return [PageMargins] value of PageMargins