Class: OoxmlParser::RunProperties
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::RunProperties
- Defined in:
- lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties.rb
Overview
Data about ‘rPr` object
Instance Attribute Summary collapse
-
#baseline ⇒ Object
Returns the value of attribute baseline.
-
#caps ⇒ Object
Returns the value of attribute caps.
-
#color ⇒ RunSpacing
Get color.
-
#dirty ⇒ Object
Returns the value of attribute dirty.
-
#emboss ⇒ Object
Returns the value of attribute emboss.
-
#font_color ⇒ Object
Returns the value of attribute font_color.
-
#font_name ⇒ Object
Returns the value of attribute font_name.
-
#font_size ⇒ Object
Returns the value of attribute font_size.
-
#font_size_complex ⇒ Float
This element specifies the font size which shall be applied to all complex script characters in the contents of this run when displayed.
-
#font_style ⇒ Object
Returns the value of attribute font_style.
-
#hyperlink ⇒ Object
Returns the value of attribute hyperlink.
-
#language ⇒ Language
Language property.
-
#outline ⇒ Object
Returns the value of attribute outline.
-
#position ⇒ Position
Position property.
-
#rtl ⇒ Object
Returns the value of attribute rtl.
-
#run_style ⇒ RunStyle
Run style.
-
#shade ⇒ Shade
Shade property.
-
#shadow ⇒ Object
Returns the value of attribute shadow.
-
#size ⇒ Size
Get run size.
-
#space ⇒ Object
Returns the value of attribute space.
-
#spacing ⇒ RunSpacing
Get run spacing.
-
#vanish ⇒ Object
Returns the value of attribute vanish.
-
#vertical_align ⇒ Object
Returns the value of attribute vertical_align.
Attributes inherited from OOXMLDocumentObject
Instance Method Summary collapse
-
#initialize(parent: nil) ⇒ RunProperties
constructor
A new instance of RunProperties.
-
#parse(node) ⇒ RunProperties
Parse RunProperties object.
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(parent: nil) ⇒ RunProperties
Returns a new instance of RunProperties.
36 37 38 39 40 41 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties.rb', line 36 def initialize(parent: nil) @font_name = '' @font_style = FontStyle.new @baseline = :baseline @parent = parent end |
Instance Attribute Details
#baseline ⇒ Object
Returns the value of attribute baseline.
11 12 13 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties.rb', line 11 def baseline @baseline end |
#caps ⇒ Object
Returns the value of attribute caps.
11 12 13 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties.rb', line 11 def caps @caps end |
#color ⇒ RunSpacing
Returns get color.
22 23 24 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties.rb', line 22 def color @color end |
#dirty ⇒ Object
Returns the value of attribute dirty.
11 12 13 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties.rb', line 11 def dirty @dirty end |
#emboss ⇒ Object
Returns the value of attribute emboss.
14 15 16 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties.rb', line 14 def emboss @emboss end |
#font_color ⇒ Object
Returns the value of attribute font_color.
11 12 13 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties.rb', line 11 def font_color @font_color end |
#font_name ⇒ Object
Returns the value of attribute font_name.
11 12 13 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties.rb', line 11 def font_name @font_name end |
#font_size ⇒ Object
Returns the value of attribute font_size.
11 12 13 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties.rb', line 11 def font_size @font_size end |
#font_size_complex ⇒ Float
This element specifies the font size which shall be applied to all complex script characters in the contents of this run when displayed
34 35 36 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties.rb', line 34 def font_size_complex @font_size_complex end |
#font_style ⇒ Object
Returns the value of attribute font_style.
11 12 13 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties.rb', line 11 def font_style @font_style end |
#hyperlink ⇒ Object
Returns the value of attribute hyperlink.
11 12 13 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties.rb', line 11 def hyperlink @hyperlink end |
#language ⇒ Language
Returns language property.
24 25 26 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties.rb', line 24 def language @language end |
#outline ⇒ Object
Returns the value of attribute outline.
11 12 13 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties.rb', line 11 def outline @outline end |
#position ⇒ Position
Returns position property.
26 27 28 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties.rb', line 26 def position @position end |
#rtl ⇒ Object
Returns the value of attribute rtl.
16 17 18 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties.rb', line 16 def rtl @rtl end |
#run_style ⇒ RunStyle
Returns run style.
30 31 32 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties.rb', line 30 def run_style @run_style end |
#shade ⇒ Shade
Returns shade property.
28 29 30 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties.rb', line 28 def shade @shade end |
#shadow ⇒ Object
Returns the value of attribute shadow.
13 14 15 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties.rb', line 13 def shadow @shadow end |
#size ⇒ Size
Returns get run size.
18 19 20 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties.rb', line 18 def size @size end |
#space ⇒ Object
Returns the value of attribute space.
11 12 13 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties.rb', line 11 def space @space end |
#spacing ⇒ RunSpacing
Returns get run spacing.
20 21 22 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties.rb', line 20 def spacing @spacing end |
#vanish ⇒ Object
Returns the value of attribute vanish.
15 16 17 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties.rb', line 15 def vanish @vanish end |
#vertical_align ⇒ Object
Returns the value of attribute vertical_align.
11 12 13 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties.rb', line 11 def vertical_align @vertical_align end |
Instance Method Details
#parse(node) ⇒ RunProperties
Parse RunProperties object
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties.rb', line 46 def parse(node) @font_style = Presentation.current_font_style.dup node.attributes.each do |key, value| case key when 'sz' @font_size = value.value.to_f / 100.0 when 'szCs' @font_size_complex = node.attribute('val').value.to_i / 2.0 when 'spc' @space = OoxmlSize.new(value.value.to_f, :one_100th_point) when 'b' @font_style.bold = option_enabled?(node, 'b') when 'i' @font_style.italic = option_enabled?(node, 'i') when 'u' @font_style.underlined = Underline.new(parent: self).parse(value.value) when 'strike' @font_style.strike = value_to_symbol(value) when 'baseline' case value.value.to_i when -25_000, -30_000 @baseline = :subscript when 30_000 @baseline = :superscript when 0 @baseline = :baseline end when 'cap' @caps = value.value.to_sym end end node.xpath('*').each do |node_child| case node_child.name when 'sz' @size = Size.new.parse(node_child) when 'shadow' @shadow = option_enabled?(node_child) when 'emboss' @emboss = option_enabled?(node_child) when 'vanish' @vanish = option_enabled?(node_child) when 'rtl' @rtl = option_enabled?(node_child) when 'spacing' @spacing = RunSpacing.new(parent: self).parse(node_child) when 'color' @color = OoxmlColor.new(parent: self).parse(node_child) when 'solidFill' @font_color = Color.parse_color(node_child.xpath('*').first) when 'latin' @font_name = node_child.attribute('typeface').value when 'b' @font_style.bold = option_enabled?(node_child) when 'i' @font_style.italic = option_enabled?(node_child, 'i') when 'u' @font_style.underlined = Underline.new(:single) when 'vertAlign' @vertical_align = node_child.attribute('val').value.to_sym when 'rFont' @font_name = node_child.attribute('val').value when 'rFonts' @font_name = node_child.attribute('ascii').value if node_child.attribute('ascii') when 'strike' @font_style.strike = option_enabled?(node_child) when 'hlinkClick' @hyperlink = Hyperlink.new(parent: self).parse(node_child) when 'ln' @outline = Outline.new(parent: self).parse(node_child) when 'lang' @language = Language.new(parent: self).parse(node_child) when 'position' @position = Position.new(parent: self).parse(node_child) when 'shd' @shade = Shade.new(parent: self).parse(node_child) when 'rStyle' @run_style = RunStyle.new(parent: self).parse(node_child) end end @font_color = DocxColorScheme.new(parent: self).parse(node) @font_name = Presentation.default_font_typeface if @font_name.empty? @font_size = Presentation.default_font_size if @font_size.nil? self end |