class Docxi::Word::Contents::Paragraph

Attributes

content[RW]
id[RW]
options[RW]
relationships[RW]

Public Class Methods

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

  if block_given?
    yield self
  else

  end
end

Public Instance Methods

br(options={}) click to toggle source
# File lib/docxi/word/contents/paragraph.rb, line 104
def br(options={})
  br = Docxi::Word::Contents::Break.new(options)
  @content << br
  br
end
content_type() click to toggle source
# File lib/docxi/word/contents/paragraph.rb, line 20
def content_type
  "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink"
end
frame(options={}, &block) click to toggle source
# File lib/docxi/word/contents/paragraph.rb, line 98
def frame(options={}, &block)
  element = Docxi::Word::Contents::Frame.new(options, &block)
  @content << element
  element
end
image(image, options={}) click to toggle source
# File lib/docxi/word/contents/paragraph.rb, line 116
def image(image, options={})
  img = Docxi::Word::Contents::Image.new(image, options)
  @content << img
  img
end
render(xml) click to toggle source
# File lib/docxi/word/contents/paragraph.rb, line 64
def render(xml)
  xml['w'].p do
    xml['w'].pPr do
      xml['w'].jc( 'w:val' => @options[:align]) if @options[:align]
      xml['w'].shd( 'w:val' => 'clear','w:fill' => @options[:fill] ) if @options[:fill]
      xml['w'].ind( 'w:left' => @options[:left], 'w:right' => @options[:right] ) if @options[:left] and @options[:right]
      if options[:ul]
        xml['w'].numPr do
          xml['w'].ilvl( 'w:val' => 0 )
          xml['w'].numId( 'w:val' => 1 )
        end
      end
      if options[:bottom]
        xml['w'].pBdr do
          xml['w'].top( 'w:val' => "nil")
          xml['w'].left('w:val' => "nil")
          xml['w'].bottom('w:val'=>"single", 'w:sz'=>"4", 'w:space'=>"1", 'w:color'=>"000000")
          xml['w'].right('w:val'=>"nil")
        end
      end
    end
    @content.each do |element|
      element.render(xml)
    end
  end
end
tab(options={}) click to toggle source
# File lib/docxi/word/contents/paragraph.rb, line 110
def tab(options={})
  tab = Docxi::Word::Contents::Tab.new(options)
  @content << tab
  tab
end
target() click to toggle source
# File lib/docxi/word/contents/paragraph.rb, line 24
def target
  "document.xml"
end
text(text, options={}) click to toggle source
# File lib/docxi/word/contents/paragraph.rb, line 91
def text(text, options={})
  options = @options.merge(options)
  text = Docxi::Word::Contents::Text.new(text, options)
  @content << text
  text
end