Class: OoxmlParser::PictureDimension

Inherits:
OOXMLDocumentObject show all
Defined in:
lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/size_relative/picture_dimension.rb

Overview

Class for parsing ‘wp14:pctWidth`, `wp14:pctHeight` object

Instance Attribute Summary collapse

Attributes inherited from OOXMLDocumentObject

#parent

Instance Method Summary collapse

Methods inherited from OOXMLDocumentObject

#==, #boolean_attribute_value, #initialize, #parse_xml, #with_data?

Methods included from OoxmlObjectAttributeHelper

#attribute_enabled?, #option_enabled?

Methods included from OoxmlDocumentObjectHelper

#to_hash

Constructor Details

This class inherits a constructor from OoxmlParser::OOXMLDocumentObject

Instance Attribute Details

#valueFloat

Returns value of picture width or height.

Returns:

  • (Float)

    value of picture width or height



7
8
9
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/size_relative/picture_dimension.rb', line 7

def value
  @value
end

Instance Method Details

#parse(node) ⇒ PictureWidth

Parse PictureWidth

Parameters:

  • node (Nokogiri::XML:Node)

    with PictureWidth

Returns:

  • (PictureWidth)

    result of parsing



12
13
14
15
16
17
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/size_relative/picture_dimension.rb', line 12

def parse(node)
  # value should be in percent as said in
  # https://msdn.microsoft.com/en-us/library/documentformat.openxml.office2010.word.drawing.relativewidth%28v=office.14%29.aspx?f=255&MSPPError=-2147217396
  @value = OoxmlSize.new(node.child.text.to_f, :one_1000th_percent)
  self
end