website/index.txt in roo-0.0.2 vs website/index.txt in roo-0.0.3

- old
+ new

@@ -1,71 +1,92 @@ h1. roo -h1. &#x2192; 'roo' - - h2. What +This gem allows you to access the values from open-office documents (.ods). h2. Installing <pre syntax="ruby">sudo gem install roo</pre> h2. The basics -This gem allows you to access the values from open-office documents (.ods). +Currently only read-access is implemented. Please note that the upper left cell of a table is numbered (1,1) or (1,'A') (not 0,0). h2. Demonstration of usage -Not a complete tutorial (I will add this later) but these snippets from the tests will hopefully show you how to use this gem. +Supposed you have created this spreadsheet: -<pre> -<code> -def test_sheets - oo = Openoffice.new("numbers1.ods") - assert_equal ["Tabelle1","Sheet2","Sheet3"], oo.sheets - end +<img src="Screenshot-spreadsheet.png"> - def test_cell - oo = Openoffice.new("numbers1.ods") - oo.default_sheet = oo.sheets.first - assert_equal 1, oo.cell(1,1) - assert_equal 2, oo.cell(1,2) - assert_equal 3, oo.cell(1,3) - assert_equal 4, oo.cell(1,4) - assert_equal 5, oo.cell(2,1) - assert_equal 6, oo.cell(2,2) - assert_equal 7, oo.cell(2,3) - assert_equal 8, oo.cell(2,4) - assert_equal 9, oo.cell(2,5) - assert_equal "test", oo.cell(2,6) - assert_equal "string", oo.celltype(2,6) - assert_equal 11, oo.cell(2,7) +which includes the amount of work you have done for a customer. - assert_equal 10, oo.cell(4,1) - assert_equal 11, oo.cell(4,2) - assert_equal 12, oo.cell(4,3) - assert_equal 13, oo.cell(4,4) - assert_equal 14, oo.cell(4,5) +You can now process this spreadsheet with the following sample code. - assert_equal 10, oo.cell(4,'A') - assert_equal 11, oo.cell(4,'B') - assert_equal 12, oo.cell(4,'C') - assert_equal 13, oo.cell(4,'D') - assert_equal 14, oo.cell(4,'E') +<pre> +<code> + 1 require 'rubygems' + 2 require 'roo' + 3 + 4 HOURLY_RATE = 123.45 + 5 + 6 oo = Openoffice.new("/home/tp/Desktop/simple_spreadsheet.ods") + 7 oo.default_sheet = oo.sheets.first + 8 4.upto(1000) do |line| + 9 # puts "line: "+line.to_s + 10 date = oo.cell(line,'A') + 11 start_time = oo.cell(line,'B') + 12 start_time = 0.0 unless start_time + 13 end_time = oo.cell(line,'C') + 14 end_time = 0.0 unless end_time + 15 pause = oo.cell(line,'D') + 16 pause = 0.0 unless pause + 17 sum = (end_time-start_time)-pause + 18 comment = oo.cell(line,'F') + 19 amount = sum * HOURLY_RATE + 20 if date + 21 puts "#{date}\t#{sum}\t#{amount}\t#{comment}" + 22 end + 23 end +</code> +</pre> - assert_equal "date", oo.celltype(5,1) - assert_equal "1961-11-21", oo.cell(5,1) - end +which produces this output + +<pre> +<code> +2007-05-07 1.75 216.0375 lokale lauff��hige Umgebung aufgesetzt, Datenbank eingerichtet, Repository erstellt und anf��nglichen Sourcecode eingestellt +2007-05-07 1.0 123.45 Userstories erfasst +2007-05-08 1.0 123.45 Test neuen User anlegen, Perioden (��berschneidend) anzulegen +2007-05-08 1.0 123.45 Bestandsaufnahme/Aufwandssch��tzung/Korrespondenz +2007-05-08 0.5 61.725 Functional Test Ueberschneidung +2007-05-14 0.5 61.725 +2007-05-14 0.5 61.725 +2007-05-15 1.0 123.45 +2007-05-15 0.75 92.5875 G��stebuch +2007-05-15 0.5 61.725 G��stebuch +2007-05-15 0.5 61.725 G��stebuch +2007-05-16 1.0 123.45 G��stebuch +2007-05-17 0.25 30.8625 G��stebuch +2007-05-17 1.25 154.3125 G��stebuch +2007-05-18 3.0 370.35 G��stebuch +2007-05-18 1.75 216.0375 G��stebuch </code> </pre> +h2. Documentation +"rdoc":rdoc/index.html + h2. Forum "http://groups.google.com/group/ruby-roo":http://groups.google.com/group/ruby-roo + +h2. Wiki + +"http://roo.rubyforge.org/wiki/wiki.pl":http://roo.rubyforge.org/wiki/wiki.pl h2. License This code is free to use under the terms of Ruby