Sha256: 5efa18232a73f993fba76bd9444854975f11dacfa726ba96f0c1ae3516fd4095

Contents?: true

Size: 836 Bytes

Versions: 11

Compression:

Stored size: 836 Bytes

Contents

$:.unshift(File.dirname(__FILE__)+"/../lib")
require "reportbuilder"    


rb=ReportBuilder.new do
  text("First Paragraph")
  section(:name=>"Section 1") do
    section(:name=>"Section 1.1") do
      text("Paragraph inside section 1.1")
    end
    table(:name=>"Table", :header=>%w{id name}) do
      row([1,"John"])
      row([2,"Peter"])
      hr
      row([3,"John"])
      row([4,"Peter"])
      
    end
  end
  preformatted <<-EOL
def test_generate
  html=ReportBuilder.generate(:format=>:html, :name=>@title, :directory=>@tmpdir) do 
    text("hola")
  end
  doc=Hpricot(html)
  assert_equal(@title, doc.search("head/title").inner_html)
  assert_equal(@title, doc.search("body/h1").inner_html)
  assert_equal("hola", doc.search("body/p").inner_html)
end  
EOL
    text("Last paragraph")
end
rb.name="RTF output"
puts rb.to_rtf

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
reportbuilder-1.4.2 examples/create_rtf.rb
reportbuilder-1.4.1 examples/create_rtf.rb
reportbuilder-1.4.0 examples/create_rtf.rb
reportbuilder-1.3.0 examples/create_rtf.rb
reportbuilder-1.2.5 examples/create_rtf.rb
reportbuilder-1.2.4 examples/create_rtf.rb
reportbuilder-1.2.3 examples/create_rtf.rb
reportbuilder-1.2.2 examples/create_rtf.rb
reportbuilder-1.2.1 examples/create_rtf.rb
reportbuilder-1.2.0 examples/create_rtf.rb
reportbuilder-1.1.1 examples/create_rtf.rb