Class: OoxmlParser::DocxParagraphRun
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::DocxParagraphRun
- Defined in:
- lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb
Constant Summary
Constants inherited from OOXMLDocumentObject
OOXMLDocumentObject::DEFAULT_DIRECTORY_FOR_MEDIA
Instance Attribute Summary collapse
-
#alternate_content ⇒ Object
Returns the value of attribute alternate_content.
-
#background_color ⇒ Object
Returns the value of attribute background_color.
-
#break ⇒ Object
Returns the value of attribute break.
-
#caps ⇒ Object
Returns the value of attribute caps.
-
#comments ⇒ Object
Returns the value of attribute comments.
-
#cs ⇒ Object
Returns the value of attribute cs.
-
#drawings ⇒ Object
Returns the value of attribute drawings.
-
#effect ⇒ Object
Returns the value of attribute effect.
-
#em ⇒ Object
Returns the value of attribute em.
-
#emboss ⇒ Object
Returns the value of attribute emboss.
-
#endnote ⇒ Object
Returns the value of attribute endnote.
-
#fld_char ⇒ Object
Returns the value of attribute fld_char.
-
#font ⇒ Object
Returns the value of attribute font.
-
#font_color ⇒ Object
Returns the value of attribute font_color.
-
#font_style ⇒ Object
Returns the value of attribute font_style.
-
#footnote ⇒ Object
Returns the value of attribute footnote.
-
#highlight ⇒ Object
Returns the value of attribute highlight.
-
#imprint ⇒ Object
Returns the value of attribute imprint.
- #instruction ⇒ String
-
#link ⇒ Object
Returns the value of attribute link.
-
#number ⇒ Object
Returns the value of attribute number.
-
#outline ⇒ Object
Returns the value of attribute outline.
-
#page_number ⇒ Object
Returns the value of attribute page_number.
-
#position ⇒ Object
Returns the value of attribute position.
-
#rtl ⇒ Object
Returns the value of attribute rtl.
-
#shadow ⇒ Object
Returns the value of attribute shadow.
-
#shape ⇒ Object
Returns the value of attribute shape.
-
#size ⇒ Object
Returns the value of attribute size.
-
#spacing ⇒ Object
Returns the value of attribute spacing.
-
#style ⇒ Object
Returns the value of attribute style.
-
#text ⇒ Object
Returns the value of attribute text.
-
#text_fill ⇒ Object
Returns the value of attribute text_fill.
-
#text_outline ⇒ Object
Returns the value of attribute text_outline.
-
#touch ⇒ Object
Returns the value of attribute touch.
-
#vanish ⇒ Object
Returns the value of attribute vanish.
-
#vertical_align ⇒ Object
Returns the value of attribute vertical_align.
-
#w ⇒ Object
Returns the value of attribute w.
Class Method Summary collapse
- .get_style_by_id(id) ⇒ Object
- .parse(character_pr_tag, character_style = DocxParagraphRun.new, default_character = @default_character) ⇒ Object
- .parse_character(r_tag, character_style, char_number) ⇒ Object
- .parse_font_by_theme(theme) ⇒ Object
Instance Method Summary collapse
- #==(other) ⇒ Object
- #copy ⇒ Object
- #drawing ⇒ Object
-
#initialize ⇒ DocxParagraphRun
constructor
A new instance of DocxParagraphRun.
Methods inherited from OOXMLDocumentObject
add_to_xmls_stack, copy_file_and_rename_to_zip, copy_media_file, current_xml, dir, encrypted_file?, get_link_from_rels, media_folder, option_enabled?, unzip_file
Constructor Details
#initialize ⇒ DocxParagraphRun
Returns a new instance of DocxParagraphRun.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb', line 16 def initialize @number = 0 @font = 'Arial' @vertical_align = :baseline @size = 11 @font_color = Color.new @background_color = nil @font_style = FontStyle.new @text = '' @drawings = [] @link = nil @highlight = nil @shadow = nil @outline = nil @imprint = nil @emboss = nil @vanish = nil @effect = nil @caps = nil @w = false @position = 0.0 @rtl = false @em = nil @cs = false @spacing = 0.0 @break = false @touch = nil @footnote = nil @endnote = nil @fld_char = nil @style = nil @comments = [] @alternate_content = nil @page_number = false @text_outline = nil @text_fill = nil @instruction = nil end |
Instance Attribute Details
#alternate_content ⇒ Object
Returns the value of attribute alternate_content.
8 9 10 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb', line 8 def alternate_content @alternate_content end |
#background_color ⇒ Object
Returns the value of attribute background_color.
8 9 10 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb', line 8 def background_color @background_color end |
#break ⇒ Object
Returns the value of attribute break.
8 9 10 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb', line 8 def break @break end |
#caps ⇒ Object
Returns the value of attribute caps.
8 9 10 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb', line 8 def caps @caps end |
#comments ⇒ Object
Returns the value of attribute comments.
8 9 10 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb', line 8 def comments @comments end |
#cs ⇒ Object
Returns the value of attribute cs.
8 9 10 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb', line 8 def cs @cs end |
#drawings ⇒ Object
Returns the value of attribute drawings.
8 9 10 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb', line 8 def drawings @drawings end |
#effect ⇒ Object
Returns the value of attribute effect.
8 9 10 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb', line 8 def effect @effect end |
#em ⇒ Object
Returns the value of attribute em.
8 9 10 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb', line 8 def em @em end |
#emboss ⇒ Object
Returns the value of attribute emboss.
8 9 10 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb', line 8 def emboss @emboss end |
#endnote ⇒ Object
Returns the value of attribute endnote.
8 9 10 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb', line 8 def endnote @endnote end |
#fld_char ⇒ Object
Returns the value of attribute fld_char.
8 9 10 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb', line 8 def fld_char @fld_char end |
#font ⇒ Object
Returns the value of attribute font.
8 9 10 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb', line 8 def font @font end |
#font_color ⇒ Object
Returns the value of attribute font_color.
8 9 10 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb', line 8 def font_color @font_color end |
#font_style ⇒ Object
Returns the value of attribute font_style.
8 9 10 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb', line 8 def font_style @font_style end |
#footnote ⇒ Object
Returns the value of attribute footnote.
8 9 10 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb', line 8 def footnote @footnote end |
#highlight ⇒ Object
Returns the value of attribute highlight.
8 9 10 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb', line 8 def highlight @highlight end |
#imprint ⇒ Object
Returns the value of attribute imprint.
8 9 10 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb', line 8 def imprint @imprint end |
#instruction ⇒ String
14 15 16 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb', line 14 def instruction @instruction end |
#link ⇒ Object
Returns the value of attribute link.
8 9 10 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb', line 8 def link @link end |
#number ⇒ Object
Returns the value of attribute number.
8 9 10 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb', line 8 def number @number end |
#outline ⇒ Object
Returns the value of attribute outline.
8 9 10 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb', line 8 def outline @outline end |
#page_number ⇒ Object
Returns the value of attribute page_number.
8 9 10 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb', line 8 def page_number @page_number end |
#position ⇒ Object
Returns the value of attribute position.
8 9 10 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb', line 8 def position @position end |
#rtl ⇒ Object
Returns the value of attribute rtl.
8 9 10 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb', line 8 def rtl @rtl end |
#shadow ⇒ Object
Returns the value of attribute shadow.
8 9 10 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb', line 8 def shadow @shadow end |
#shape ⇒ Object
Returns the value of attribute shape.
8 9 10 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb', line 8 def shape @shape end |
#size ⇒ Object
Returns the value of attribute size.
8 9 10 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb', line 8 def size @size end |
#spacing ⇒ Object
Returns the value of attribute spacing.
8 9 10 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb', line 8 def spacing @spacing end |
#style ⇒ Object
Returns the value of attribute style.
8 9 10 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb', line 8 def style @style end |
#text ⇒ Object
Returns the value of attribute text.
8 9 10 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb', line 8 def text @text end |
#text_fill ⇒ Object
Returns the value of attribute text_fill.
8 9 10 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb', line 8 def text_fill @text_fill end |
#text_outline ⇒ Object
Returns the value of attribute text_outline.
8 9 10 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb', line 8 def text_outline @text_outline end |
#touch ⇒ Object
Returns the value of attribute touch.
8 9 10 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb', line 8 def touch @touch end |
#vanish ⇒ Object
Returns the value of attribute vanish.
8 9 10 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb', line 8 def vanish @vanish end |
#vertical_align ⇒ Object
Returns the value of attribute vertical_align.
8 9 10 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb', line 8 def vertical_align @vertical_align end |
#w ⇒ Object
Returns the value of attribute w.
8 9 10 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb', line 8 def w @w end |
Class Method Details
.get_style_by_id(id) ⇒ Object
378 379 380 381 382 383 384 385 386 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb', line 378 def self.get_style_by_id(id) doc = Nokogiri::XML(File.open("#{OOXMLDocumentObject.path_to_folder}/#{OOXMLDocumentObject.root_subfolder}/styles.xml")) doc.search('//w:styles').each do |styles| styles.xpath('w:style').each do |style| return style if style.attribute('styleId').value == id end end nil end |
.parse(character_pr_tag, character_style = DocxParagraphRun.new, default_character = @default_character) ⇒ Object
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb', line 114 def self.parse(character_pr_tag, character_style = DocxParagraphRun.new, default_character = @default_character) character_style.font_style = FontStyle.new character_pr_tag.xpath('w:rStyle').each do |r_style| style = get_style_by_id(r_style.attribute('val').value) break if style.nil? style.xpath('w:rPr').each do |style_rpr| character_style = parse(style_rpr, character_style, default_character) end end character_pr_tag.xpath('w:rFonts').each do |r_font| r_font.attributes.each do |font_attribute, value| case font_attribute when 'asciiTheme' character_style.font = parse_font_by_theme(r_font.attribute('asciiTheme').value) when 'ascii' # , 'hAnsi', 'eastAsia', 'cs' character_style.font = value.value break end end end character_pr_tag.xpath('w:highlight').each do |highlight| character_style.highlight = highlight.attribute('val').value end character_pr_tag.xpath('w:vertAlign').each do |vertical_align| character_style.vertical_align = vertical_align.attribute('val').value.to_sym end character_pr_tag.xpath('w:szCs').each do |sz| character_style.size = sz.attribute('val').value.to_i / 2.0 end character_pr_tag.xpath('w:sz').each do |sz| character_style.size = sz.attribute('val').value.to_i / 2.0 end character_pr_tag.xpath('w:color').each do |color| color.attributes.each do |key, value| case key when 'val' character_style.font_color = Color.from_int16(value.value) when 'themeColor' unless ThemeColors.list[value.value.to_sym].nil? if value.value == 'text2' || value.value == 'background2' || value.value.include?('accent') # Don't know why. Just works break else character_style.font_color = ThemeColors.list[value.value.to_sym].dup end end when 'themeShade' character_style.font_color.calculate_with_shade!(value.value.hex.to_f / 255.0) when 'themeTint' character_style.font_color.calculate_with_tint!(1.0 - (value.value.hex.to_f / 255.0)) end end end character_pr_tag.xpath('w:shd').each do |shd| character_style.background_color = shd.attribute('fill').value unless shd.attribute('fill').value == 'auto' || shd.attribute('fill').value == '' || shd.attribute('fill').value == 'null' character_style.background_color = Color.from_int16(shd.attribute('fill').value) end end character_pr_tag.xpath('w:uCs').each do |u| character_style.font_style.underlined = Underline.new if !u.attribute('val').nil? && u.attribute('val').value != 'none' && u.attribute('val').value != false character_style.font_style.underlined.style = u.attribute('val').value unless u.attribute('color').nil? character_style.font_style.underlined.color = Color.from_int16(u.attribute('color').value) end else character_style.font_style.underlined = Underline.new end end character_pr_tag.xpath('w:u').each do |u| character_style.font_style.underlined = Underline.new if !u.attribute('val').nil? && u.attribute('val').value != 'none' && u.attribute('val').value != false character_style.font_style.underlined.style = u.attribute('val').value unless u.attribute('color').nil? character_style.font_style.underlined.color = Color.from_int16(u.attribute('color').value) end else character_style.font_style.underlined = Underline.new end end character_pr_tag.xpath('w:bCs').each do |b| character_style.font_style.bold = if b.attribute('val').nil? || b.attribute('val').value != 'false' true else false end end character_pr_tag.xpath('w:b').each do |b| character_style.font_style.bold = if b.attribute('val').nil? || b.attribute('val').value != 'false' true else false end end character_pr_tag.xpath('w:iCs').each do |i| next if i.attribute('val').nil? character_style.font_style.italic = if i.attribute('val').value != 'false' true else false end end character_pr_tag.xpath('w:i').each do |i| character_style.font_style.italic = if i.attribute('val').nil? || i.attribute('val').value != 'false' true else false end end character_pr_tag.xpath('w:strike').each do |strike| character_style.font_style.strike = if strike.attribute('val').nil? || strike.attribute('val').value != 'false' && strike.attribute('val').value != '0' :single else :none end end character_pr_tag.xpath('w:dstrike').each do |dstrike| if dstrike.attribute('val').nil? character_style.font_style.strike = :double elsif dstrike.attribute('val').value == '0' || dstrike.attribute('val').value == 'false' else character_style.font_style.strike = :double end end character_pr_tag.xpath('w:shadow').each do character_style.shadow = true end character_pr_tag.xpath('w:outline').each do character_style.outline = true end character_pr_tag.xpath('w:imprint').each do character_style.imprint = true end character_pr_tag.xpath('w:emboss').each do character_style.emboss = true end character_pr_tag.xpath('w:vanish').each do character_style.vanish = true end character_pr_tag.xpath('w:effect').each do |effect| character_style.effect = effect.attribute('val').value end character_pr_tag.xpath('w:caps').each do |caps| if caps.attribute('val').nil? character_style.caps = :caps elsif caps.attribute('val').value == 'false' else character_style.caps = :caps end end character_pr_tag.xpath('w:smallCaps').each do |small_caps| if small_caps.attribute('val').nil? character_style.caps = :small_caps elsif small_caps.attribute('val').value == 'false' else character_style.caps = :small_caps end end character_pr_tag.xpath('w:position').each do |position| character_style.position = (position.attribute('val').value.to_f / (28.0 + 1.0 / 3.0) / 2.0).round(1) end character_pr_tag.xpath('w:rtl').each do |rtl| character_style.rtl = OOXMLDocumentObject.option_enabled?(rtl) end character_pr_tag.xpath('w:em').each do |em| character_style.em = em.attribute('val').value end character_pr_tag.xpath('w:cs').each do |cs| character_style.cs = OOXMLDocumentObject.option_enabled?(cs) end character_pr_tag.xpath('w:spacing').each do |spacing| character_style.spacing = (spacing.attribute('val').value.to_f / 566.9).round(1) end character_pr_tag.xpath('w14:textOutline', 'xmlns:w14' => 'http://schemas.microsoft.com/office/word/2010/wordml').each do |text_outline| character_style.text_outline = TextOutline.parse(text_outline) text_outline.xpath('w14:prstDash', 'xmlns:w14' => 'http://schemas.microsoft.com/office/word/2010/wordml').each do |outline_style| character_style.touch = outline_style.attribute('val').value end end character_pr_tag.xpath('w14:textFill', 'xmlns:w14' => 'http://schemas.microsoft.com/office/word/2010/wordml').each do |text_fill| character_style.text_fill = TextFill.parse(text_fill) end character_style end |
.parse_character(r_tag, character_style, char_number) ⇒ Object
299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb', line 299 def self.parse_character(r_tag, character_style, char_number) r_tag.xpath('*').each do |r_node_child| case r_node_child.name when 'rPr' DocxParagraphRun.parse(r_node_child, character_style, @default_character) when 'instrText' if r_node_child.text.include?('HYPERLINK') hyperlink = Hyperlink.new(r_node_child.text.sub('HYPERLINK ', '').split(' \\o ').first, r_node_child.text.sub('HYPERLINK', '').split(' \\o ').last) character_style.link = hyperlink elsif r_node_child.text[/PAGE\s+\\\*/] character_style.text = '*PAGE NUMBER*' end when 'fldChar' character_style.fld_char = r_node_child.attribute('fldCharType').value.to_sym when 't' character_style.text += r_node_child.text when 'noBreakHyphen' character_style.text += '–' when 'tab' character_style.text += "\t" when 'drawing' character_style.drawings << DocxDrawing.parse(r_node_child) when 'AlternateContent' character_style.alternate_content = AlternateContent.parse(r_node_child) when 'br' if r_node_child.attribute('type').nil? character_style.break = :line character_style.text += "\r" else case r_node_child.attribute('type').value when 'page', 'column' character_style.break = r_node_child.attribute('type').value.to_sym end end when 'footnoteReference' character_style.footnote = HeaderFooter.new(:header) character_style.footnote.id = r_node_child.attribute('id').value.to_i character_style.footnote.parse('footnote', character_style.footnote.id, @default_paragraph, @default_character) when 'endnoteReference' character_style.endnote = HeaderFooter.new(:footer) character_style.endnote.id = r_node_child.attribute('id').value.to_i character_style.endnote.parse('endnote', character_style.endnote.id, @default_paragraph, @default_character) when 'pict' r_node_child.xpath('*').each do |pict_node_child| case pict_node_child.name when 'shape' character_style.shape = Shape.parse(pict_node_child, :shape) when 'rect' character_style.shape = Shape.parse(pict_node_child, :rectangle) when 'oval' character_style.shape = Shape.parse(pict_node_child, :oval) when 'shapetype' end end end end character_style.number = char_number character_style end |
.parse_font_by_theme(theme) ⇒ Object
359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb', line 359 def self.parse_font_by_theme(theme) doc = Nokogiri::XML(File.open("#{OOXMLDocumentObject.path_to_folder}/#{OOXMLDocumentObject.root_subfolder}/theme/theme1.xml")) doc.search('//a:fontScheme').each do |font_scheme| if theme.include?('major') font_scheme.xpath('a:majorFont').each do |major_font| major_font.xpath('a:latin').each do |latin| return latin.attribute('typeface').value end end elsif theme.include?('minor') font_scheme.xpath('a:minorFont').each do |minor_font| minor_font.xpath('a:latin').each do |latin| return latin.attribute('typeface').value end end end end end |
Instance Method Details
#==(other) ⇒ Object
102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb', line 102 def ==(other) ignored_attributes = [:@number] all_instance_variables = instance_variables significan_attribues = all_instance_variables - ignored_attributes significan_attribues.each do |current_attributes| unless instance_variable_get(current_attributes) == other.instance_variable_get(current_attributes) return false end end true end |
#copy ⇒ Object
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 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb', line 60 def copy character = DocxParagraphRun.new character.number = number character.font = font character.vertical_align = vertical_align character.size = size character.font_color = font_color character.background_color = @background_color character.font_style = @font_style character.text = @text character.drawings = @drawings.clone character.link = @link character.highlight = @highlight character.shadow = @shadow character.outline = @outline character.imprint = @imprint character.emboss = @emboss character.vanish = @vanish character.effect = @effect character.caps = @caps character.w = @w character.position = @position character.rtl = @rtl character.em = @em character.cs = @cs character.spacing = @spacing character.cs = @cs character.break = @break character.touch = @touch character.footnote = @footnote character.endnote = @endnote character.fld_char = @fld_char character.style = @style character.comments = @comments.clone character.alternate_content = @alternate_content character.page_number = @page_number character.text_outline = @text_outline character.text_fill = @text_fill character.instruction = @instruction character end |
#drawing ⇒ Object
55 56 57 58 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb', line 55 def drawing # TODO: Rewrite all tests without this methos @drawings.empty? ? nil : drawings.first end |