Ask Your Question
1

Is there a RUBY Framework for LO? [closed]

asked 2012-04-19 15:01:33 +0200

anonymous user

Anonymous

Anybody know of a RUBY framework for LO?

I.e. the VB or C++ or or or script that can be used to call/start a ruby console (IRB, rails, sketchup, etc)

I guess for that matter, anybody know of RUBY framework that could digest a LO document?

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2016-03-06 13:06:46.460089

Comments

1

Actually I would be more interested in some sort of framework where LO could call a ruby program

vojo gravatar imagevojo ( 2012-06-25 03:06:40 +0200 )edit

@vojo, Why do you want to call a ruby program from within a LO document?

qubit gravatar imagequbit ( 2013-01-24 22:50:20 +0200 )edit

2 Answers

Sort by » oldest newest most voted
1

answered 2012-06-25 01:30:21 +0200

qubit gravatar image

updated 2013-03-13 09:48:07 +0200

https://rubygems.org/gems/rods

"a Ruby-Library for batch-processing of OpenDocument-Spreadsheets (therefore compatible with the well known GUI-applications LibreOffice and OpenOffice)."

http://www.rubyreports.org/

This one seems to be a framework for using Ruby to create ODF docs.


Actually I would be more interested in some sort of framework where LO could call a ruby program

I don't know how one would do that, and I'm not sure why LO would do that. Do you have a specific use case you could share?

edit flag offensive delete link more
0

answered 2014-11-19 05:55:14 +0200

gorn gravatar image

updated 2014-11-19 05:56:39 +0200

I am writing

https://github.com/gorn/rspreadsheet

It allows manipulating spreadsheets with Ruby. Read, modify, write or create new OpenDocument Spreadsheet files from ruby code. I humbly think it is far better then rods and I am actively developing it. I would be grateful for any feedback on this.

Examples of usage

require 'rspreadsheet'
book = Rspreadsheet.open('spreadsheet.ods')
sheet = book.worksheets[1]


# get value of a cell B5 (there are more ways to do this)
sheet.B5                       # => 'cell value'
sheet[5,2]                     # => 'cell value'
sheet.rows(5).cells(2).value   # => 'cell value'

# set value of a cell B5
sheet.F5 = 'text'
sheet[5,2] = 7
sheet.cells(5,2).value = 1.78

# working with cell format
sheet.cells(5,2).format.bold = true
sheet.cells(5,2).format.background = '#FF0000'

# calculating sum of cells in row
sheet.rows(5).cellvalues.sum
sheet.rows(5).cells.sum{ |cell| cell.value }

# iterating over list of people and displaying the data

total = 0
sheet.rows.each do |row|
  puts "Sponsor #{row[1]} with email #{row(2)} has donated #{row(3)} USD."
  total += row[3]
end
puts "Totally fundraised #{total} USD"

# saving file
book.save
book.save('different_filename.ods')
edit flag offensive delete link more

Question Tools

Stats

Asked: 2012-04-19 15:01:33 +0200

Seen: 2,615 times

Last updated: Nov 19 '14