class Docxer::Word::Contents::Paragraph

Attributes

content[RW]
options[RW]

Public Class Methods

new(options={}) { |self| ... } click to toggle source
# File lib/docxer/word/contents/paragraph.rb, line 8
def initialize(options={})
  @content = []
  @options = options

  if block_given?
    yield self
  else

  end
end

Public Instance Methods

br(options={}) click to toggle source
# File lib/docxer/word/contents/paragraph.rb, line 43
def br(options={})
  br = Docxer::Word::Contents::Break.new(options)
  @content << br
  br
end
image(image, options={}) click to toggle source
# File lib/docxer/word/contents/paragraph.rb, line 49
def image(image, options={})
  img = Docxer::Word::Contents::Image.new(image, options)
  @content << img
  img
end
render(xml) click to toggle source
# File lib/docxer/word/contents/paragraph.rb, line 19
def render(xml)
  xml['w'].p do
    xml['w'].pPr do
      xml['w'].jc( 'w:val' => @options[:align]) if @options[:align]
      if options[:ul]
        xml['w'].numPr do
          xml['w'].ilvl( 'w:val' => 0 )
          xml['w'].numId( 'w:val' => 1 )
        end
      end
    end
    @content.each do |element|
      element.render(xml)
    end
  end
end
text(text, options={}) click to toggle source
# File lib/docxer/word/contents/paragraph.rb, line 36
def text(text, options={})
  options = @options.merge(options)
  text = Docxer::Word::Contents::Text.new(text, options)
  @content << text
  text
end