This is probably a lot easier if you use Roo. Full details available here: http://roo.rubyforge.org/ An example on how to read OpenOffice here: http://watirmelon.wordpress.com/2009/01/05/watir-and-roo/ The advantage is that you can then switch between excel, OO and GDocs without any code change.
Cheers, Alister On Jan 23, 4:00 am, "dmitry...@gmail.com" <dmitry...@gmail.com> wrote: > Yeah that makes sense. I don't mind contributing to your minds at > all. > Here is how I've implemented the .ods data file read between two > scripts. > > firstscript.rb: > > require 'secondscript' > > class FirstScript > def testone(x, y) > > #these control the columns within the .ods file > i = #{y + 1} > j = #{x + 1} > k= #{x + 2} > l = #{x + 3} > > noArgs = [] > file_uri = "file:///c:/test.ods" > > serviceManager = WIN32OLE.new("com.sun.star.ServiceManager") > coreReflection = serviceManager.createInstance > ("com.sun.star.reflection.CoreReflection") > desktop = serviceManager.createInstance("com.sun.star.frame.Desktop") > spreadsheet = desktop.loadComponentFromURL(file_uri, "_blank", 0, > noArgs) > sheetsCollection = spreadsheet.Sheets > sheet1 = sheetsCollection.getByIndex(0) > > $browser.text_field(:id,'position1').value = sheet1.getCellByPosition > (i, j).Formula > sleep 2 > > $browser.text_field(:id,'position2').value = sheet1.getCellByPosition > (i, k).Formula > sleep 2 > > $browser.text_field(:id,'position3').value = sheet1.getCellByPosition > (i, l).Formula > sleep 2 > > end > > SecondScript.new.testtwo([-1, 0], [-1, 1], [-1, 2]) > > end > > secondscript.rb goes like this: > > require "firstscript" > > class SecondScript > > def testtwo(a, b, c) > > FirstScript.new.testone (*a) #The *a > controls the rows within the .ods file > > FirstScript.new.testone (*b) > > FirstScript.new.testone (*c) > end > end --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Watir General" group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~----------~----~----~----~------~----~------~--~---