[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Excel file modification without win32ole

Julius de Bruijn

2/19/2006 5:56:00 PM

Greetings,

I've been coding some internal tools for my company with Ruby for several
months and I'd like to distribute some of those tools to other employees too.
I have one specific tool, which does some calculations and iterations,
displays the values in a table and saves everything to a specified Excel
template. The toolkit I've been using is Tk in W2k, Linux and OSX.

The problem is the win32ole class. Handling Excel files through the class is
very slow, and if I pack my program to an exe file with rubyscript2exe, saving
..xls files through win32ole halts the whole program. I've been searching some
better classes for reading and writing Excel files with no success. The
template I'm using is quite complex with many formulae and vba scripts.

I'm sorry I can't publish any code here, but if somebody could give me some
good hints for better ways to modify and save .xls even without MS Office, the
next working week would be much nicer... :)
4 Answers

Daniel Berger

2/20/2006 3:53:00 AM

0

Julius de Bruijn wrote:
> Greetings,
>
> I've been coding some internal tools for my company with Ruby for several
> months and I'd like to distribute some of those tools to other employees too.
> I have one specific tool, which does some calculations and iterations,
> displays the values in a table and saves everything to a specified Excel
> template. The toolkit I've been using is Tk in W2k, Linux and OSX.
>
> The problem is the win32ole class. Handling Excel files through the class is
> very slow, and if I pack my program to an exe file with rubyscript2exe, saving
> .xls files through win32ole halts the whole program. I've been searching some
> better classes for reading and writing Excel files with no success. The
> template I'm using is quite complex with many formulae and vba scripts.
>
> I'm sorry I can't publish any code here, but if somebody could give me some
> good hints for better ways to modify and save .xls even without MS Office, the
> next working week would be much nicer... :)

See http://raa.ruby-lang.org/project/sp... if you don't mind
that it uses the Excel 95 format.

Regards,

Dan

pimeys

2/20/2006 4:41:00 AM

0

> See http://raa.ruby-lang.org/project/sp... if you don't mind
> that it uses the Excel 95 format.

That's the module I've been trying to use in my program instead of
win32ole class. The problem is that the spreadsheet class doesn't
support opening an Excel template, it only creates a new file. My
current Excel template is quite complex with seven worksheets, hundreds
of formulae and several hundred lines of VBA, so creating it from
scratch with Ruby's spreadsheet module is out of question.

The problem with win32ole was it's halt when using a compiled
rubyscript2exe version of the program. With small tweaking, I made it
to work. I was using "require 'win32ole'" in a method rather than
loading it in the beginning of the file, which was not very smart move.
The slowness of ole commands and the requirement of Excel still bugs
me, but maybe I can live with it for now.

Dominic Sisneros

2/22/2006 6:52:00 AM

0

See Spreadsheet::ParseExcel http://download.ywesee.com/...

http://download.ywesee.com/...

Spreadsheet::ParseExcel - Get information from an Excel file.
============
Version: 0.4.0
Date: 2006-02-16

Short Description:
Spreadsheet::ParseExcel allows you to get information out of a
simple Excel file
This Package is an - as of today incomplete - translation of
Kawai Takanoris Perl-Module.


Requirements
------------

* ruby 1.8

Install
-------

De-Compress archive and enter its top directory.
Then type:

$ ruby setup.rb config
$ ruby setup.rb setup
($ su)
# ruby setup.rb install

You can also install files into your favorite directory
by supplying setup.rb some options. Try "ruby setup.rb --help".


Usage
-----
workbook = Spreadsheet::ParseExcel.parse(path_to_file)
worksheet = workbook.worksheet(0)
worksheet.each(1) { |row|
puts row.at(0)
}


On 2/19/06, Julius de Bruijn <pimeys@kobaia.net> wrote:
>
> Greetings,
>
> I've been coding some internal tools for my company with Ruby for several
> months and I'd like to distribute some of those tools to other employees
> too.
> I have one specific tool, which does some calculations and iterations,
> displays the values in a table and saves everything to a specified Excel
> template. The toolkit I've been using is Tk in W2k, Linux and OSX.
>
> The problem is the win32ole class. Handling Excel files through the class
> is
> very slow, and if I pack my program to an exe file with rubyscript2exe,
> saving
> ..xls files through win32ole halts the whole program. I've been searching
> some
> better classes for reading and writing Excel files with no success. The
> template I'm using is quite complex with many formulae and vba scripts.
>
> I'm sorry I can't publish any code here, but if somebody could give me
> some
> good hints for better ways to modify and save .xls even without MS Office,
> the
> next working week would be much nicer... :)
>
>

Shall not be infringed

5/17/2010 10:54:00 PM

0

On May 17, 3:35 pm, Lookout <mrLook...@yahoo.com> wrote:
> On Sun, 16 May 2010 17:03:44 -0700 (PDT), Shall not be infringed
>
>
>
>
>
> <hot-ham-and-che...@hotmail.com> wrote:
> >On May 16, 1:04 pm, Lookout <mrLook...@yahoo.com> wrote:
> >> On Sun, 16 May 2010 08:21:39 -0700, tankfixer <paul.carr...@gmail.com>
> >> wrote:
>
> >> >In article <hsnu3a$i4q...@news.eternal-september.org>,
> >> >CurlySurmudg...@live.com says...
>
> >> >> On Sat, 15 May 2010 17:02:09 -0700, tankfixer <paul.carr...@gmail.com>
> >> >> wrote:
>
> >> >> > In article <hsmn23$i4q...@news.eternal-september.org>,
> >> >> > CurlySurmudg...@live.com says...
>
> >> >> >> Your "many" is a minority and they are wrong.
>
> >> >> > You sound pretty dogmatic about that belief...
>
> >> >> Feel free to prove the statement wrong.  That is the difference between
> >> >> an atheist and a crazymotherfucker religionist.  For the most part we are
> >> >> quite willing to revisit our opinions should new evidence be brought to
> >> >> bear on the subject.
>
> >> >Sorry my little fascist friend, it is not my statement to prove or
> >> >disprove, it is your's.
>
> >> >> Religionists have *faith* that transcends critical thought and deductive
> >> >> reasoning.  That's why you are known as a crazymotherfucker.
>
> >> >Typical leftist, always with the hate speech.
>
> >> HAHAHAAAH
> >> You made a joke!
>
> >It wasn't funny if it was a joke.  I hope to never read about a
> >"CrazyMotherFucker" rampage from Argentina.
>
> You conservatives have the market cornered on hate speech. The
> "leftists" can't compete with you.

I know we are just terrible people talking about the Constitution and
all. Just terrible.

Equality before the law, not equality through redistribution of
wealth. Now that's hatred in it's purest sense.

> >I wonder if his community understands they have a ticking time-bomb
> >for a new neighbor?
>
> >They should watch for all the signs... especially if the Dresden Flag
> >is even flown over the compound.
>
> 99% of Americans couldn't identify the Dresden Flag. But YOU can. YOU
> know about it, don't you?

Cur-Lee say he flies his.

I have only an American Flag; it was presented to me upon my
retirement.