Method: Docxi::Word::Contents::Text#render

Defined in:
lib/docxi/word/contents/text.rb

#render(xml) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/docxi/word/contents/text.rb', line 13

def render(xml)
  if !@text.nil?
    xml['w'].r do
      xml['w'].rPr do
        xml['w'].b if @options[:bold]
        xml['w'].i if @options[:italic]
        xml['w'].u( 'w:val' => "single" ) if options[:underline]
        xml['w'].color( 'w:val' => @options[:color] ) if @options[:color]
        xml['w'].sz( 'w:val' => @options[:size].to_i * 2 ) if @options[:size]
      end
      xml['w'].t @text
    end
    if options[:br]
      br = Docxi::Word::Contents::Break.new
      br.render(xml)
    end
  end
end