Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.ruby > #4768 > unrolled thread
| Started by | Will James <ampclj9@hotmail.com> |
|---|---|
| First post | 2011-05-19 11:22 -0500 |
| Last post | 2011-05-26 12:46 -0500 |
| Articles | 20 on this page of 23 — 11 participants |
Back to article view | Back to comp.lang.ruby
Writing formulas to excel spreadsheet Will James <ampclj9@hotmail.com> - 2011-05-19 11:22 -0500
Re: Writing formulas to excel spreadsheet Mike Stephens <rubfor@recitel.net> - 2011-05-19 16:58 -0500
Re: Writing formulas to excel spreadsheet 7stud -- <bbxx789_05ss@yahoo.com> - 2011-05-19 17:37 -0500
Re: Writing formulas to excel spreadsheet Will James <ampclj9@hotmail.com> - 2011-05-19 23:42 -0500
Re: Writing formulas to excel spreadsheet Chuck Remes <cremes.devlist@mac.com> - 2011-05-20 09:28 -0500
Saving Electricty - Using a Blackboard? Mike Stephens <rubfor@recitel.net> - 2011-05-20 12:41 -0500
Re: Saving Electricty - Using a Blackboard? Will James <ampclj9@hotmail.com> - 2011-05-20 13:19 -0500
Matz never said Microsoft was the Devil Incarnate. (or did he?) Mike Stephens <rubfor@recitel.net> - 2011-05-20 16:36 -0500
Re: Matz never said Microsoft was the Devil Incarnate. (or did he?) Daniel Berger <djberg96@gmail.com> - 2011-05-20 17:02 -0500
Re: Matz never said Microsoft was the Devil Incarnate. (or did he?) Will James <ampclj9@hotmail.com> - 2011-05-20 21:28 -0500
Re: Matz never said Microsoft was the Devil Incarnate. (or did he?) Mike Stephens <rubfor@recitel.net> - 2011-05-21 16:14 -0500
Re: Matz never said Microsoft was the Devil Incarnate. (or did he?) Damjan Rems <d_rems@yahoo.com> - 2011-05-23 15:18 -0500
Re: Matz never said Microsoft was the Devil Incarnate. (or did he?) Will James <ampclj9@hotmail.com> - 2011-05-24 11:45 -0500
Re: Matz never said Microsoft was the Devil Incarnate. (or did he?) Mike Stephens <rubfor@recitel.net> - 2011-05-23 16:38 -0500
Re: Matz never said Microsoft was the Devil Incarnate. (or did he?) Michal Suchanek <hramrach@centrum.cz> - 2011-05-23 18:00 -0500
Keep your options open Mike Stephens <rubfor@recitel.net> - 2011-05-24 12:45 -0500
Re: Keep your options open Johnny Morrice <spoon@killersmurf.com> - 2011-05-24 13:22 -0500
Re: Keep your options open Stu <stu@rubyprogrammer.net> - 2011-05-24 16:55 -0500
Re: Matz never said Microsoft was the Devil Incarnate. (or did he?) Christopher Dicely <cmdicely@gmail.com> - 2011-05-23 20:53 -0500
Re: Matz never said Microsoft was the Devil Incarnate. (or did he?) Colin Bartlett <colinb2r@googlemail.com> - 2011-05-25 10:27 -0500
Re: Matz never said Microsoft was the Devil Incarnate. (or did he?) Mike Stephens <rubfor@recitel.net> - 2011-05-25 11:54 -0500
Re: Matz never said Microsoft was the Devil Incarnate. (or did he?) Will James <ampclj9@hotmail.com> - 2011-05-25 13:53 -0500
Re: Matz never said Microsoft was the Devil Incarnate. (or did he?) Will James <ampclj9@hotmail.com> - 2011-05-26 12:46 -0500
Page 1 of 2 [1] 2 Next page →
| From | Will James <ampclj9@hotmail.com> |
|---|---|
| Date | 2011-05-19 11:22 -0500 |
| Subject | Writing formulas to excel spreadsheet |
| Message-ID | <267f0e6b73bdfa961dbda489c97c181d@ruby-forum.com> |
Hi, everyone. I've just started using ruby a couple of days ago, and I've been using it to read data from text files and write to excel spreadsheets. I also need to be able to write formulas to spreadsheets, but when I open the excel file, the formula is in there without having been evaluated - for example, the cell will appear as "=A1+A58+A114" instead of whatever the value of that sum happens to be. If I click on the cell and hit "enter," the formula will evaluate, but it does not do so automatically. Is there any way to get ruby to force excel to evaluate? Thanks! -- Posted via http://www.ruby-forum.com/.
[toc] | [next] | [standalone]
| From | Mike Stephens <rubfor@recitel.net> |
|---|---|
| Date | 2011-05-19 16:58 -0500 |
| Message-ID | <7ee671500075e2f3292be2091ec54ac4@ruby-forum.com> |
| In reply to | #4768 |
Have a look at :rubyonwindows.blogspot.com/search/label/excel and look for 'formula' -- Posted via http://www.ruby-forum.com/.
[toc] | [prev] | [next] | [standalone]
| From | 7stud -- <bbxx789_05ss@yahoo.com> |
|---|---|
| Date | 2011-05-19 17:37 -0500 |
| Message-ID | <a4f6164321d5d3e60445e840ef18b42e@ruby-forum.com> |
| In reply to | #4787 |
Mike Stephens wrote in post #999754:
> Have a look at :rubyonwindows.blogspot.com/search/label/excel
>
> and look for 'formula'
..which shows this:
Adding Formulae
emptyRow = 15
worksheet.Range("t#{emptyRow}")['Formula'] =
"=(Q#{emptyRow}+L#{emptyRow}+I#{emptyRow}+S#{emptyRow})"
--
Posted via http://www.ruby-forum.com/.
[toc] | [prev] | [next] | [standalone]
| From | Will James <ampclj9@hotmail.com> |
|---|---|
| Date | 2011-05-19 23:42 -0500 |
| Message-ID | <6d10d965e1a796d6b5755384175c3781@ruby-forum.com> |
| In reply to | #4788 |
7stud -- wrote in post #999761:
> Mike Stephens wrote in post #999754:
>> Have a look at :rubyonwindows.blogspot.com/search/label/excel
>>
>> and look for 'formula'
>
> ...which shows this:
>
> Adding Formulae
>
> emptyRow = 15
> worksheet.Range("t#{emptyRow}")['Formula'] =
> "=(Q#{emptyRow}+L#{emptyRow}+I#{emptyRow}+S#{emptyRow})"
Thanks, guys. However, the above seems to require win32ole, for which,
if I'm not mistaken, you need office to be installed on the system.
Is there a way to do this with just the spreadsheet gem (i.e. just
require spreadsheet)?
--
Posted via http://www.ruby-forum.com/.
[toc] | [prev] | [next] | [standalone]
| From | Chuck Remes <cremes.devlist@mac.com> |
|---|---|
| Date | 2011-05-20 09:28 -0500 |
| Message-ID | <769B8130-EEDD-4B61-AF4A-DDE095D81CC9@mac.com> |
| In reply to | #4793 |
On May 19, 2011, at 11:42 PM, Will James wrote:
> 7stud -- wrote in post #999761:
>> Mike Stephens wrote in post #999754:
>>> Have a look at :rubyonwindows.blogspot.com/search/label/excel
>>>
>>> and look for 'formula'
>>
>> ...which shows this:
>>
>> Adding Formulae
>>
>> emptyRow = 15
>> worksheet.Range("t#{emptyRow}")['Formula'] =
>> "=(Q#{emptyRow}+L#{emptyRow}+I#{emptyRow}+S#{emptyRow})"
>
> Thanks, guys. However, the above seems to require win32ole, for which,
> if I'm not mistaken, you need office to be installed on the system.
> Is there a way to do this with just the spreadsheet gem (i.e. just
> require spreadsheet)?
I looked through the code in the spreadsheet gem a few months ago (2?) looking for this functionality. As far as I could tell, it was not yet possible to *write* formulas to a spreadsheet cell. It looks like that functionality is on the roadmap. Look at the "roadmap" section on the homepage: http://spreadsheet.rubyforge.org/
Looks like formula support isn't slated until version 0.8.0 (and we're on 0.6.x right now).
cr
[toc] | [prev] | [next] | [standalone]
| From | Mike Stephens <rubfor@recitel.net> |
|---|---|
| Date | 2011-05-20 12:41 -0500 |
| Subject | Saving Electricty - Using a Blackboard? |
| Message-ID | <ff3e0e407223c2a16e22e7835dd33275@ruby-forum.com> |
| In reply to | #4793 |
Will James wrote in post #999789: >the above seems to require win32ole, for which, > if I'm not mistaken, you need office to be installed on the system. I'm intrigued - how are you running Excel to get it to calculate formulae if it's not on your computer? As it happens, I don't think win32ole has got anything to do with Office anyway. It's to do with OLE, which is a Windows feature. Excel happens to present an OLE object model. -- Posted via http://www.ruby-forum.com/.
[toc] | [prev] | [next] | [standalone]
| From | Will James <ampclj9@hotmail.com> |
|---|---|
| Date | 2011-05-20 13:19 -0500 |
| Subject | Re: Saving Electricty - Using a Blackboard? |
| Message-ID | <aa4fb099a15186c969287aa747b09bb4@ruby-forum.com> |
| In reply to | #4827 |
Mike Stephens wrote in post #999926:
> Will James wrote in post #999789:
>>the above seems to require win32ole, for which,
>> if I'm not mistaken, you need office to be installed on the system.
>
> I'm intrigued - how are you running Excel to get it to calculate
> formulae if it's not on your computer?
>
> As it happens, I don't think win32ole has got anything to do with Office
> anyway. It's to do with OLE, which is a Windows feature. Excel happens
> to present an OLE object model.
There are alternatives to office (i.e. openoffice) which allow you to
work with excel spreadsheets but don't provide the necessary COM objects
or whatever it is that's needed to use some features of certain
libraries or modules in certain languages. I think to do:
class ExcelConst
end
WIN32OLE.const_load(excel, ExcelConst)
or
excel = WIN32OLE::new('excel.Application')
you do need to have excel installed. I remember in perl, to do stuff
like:
use Win32::OLE qw(in with);
use Win32::OLE::Const 'Microsoft Excel';
you need to have excel on the system. I'm not a professional programmer
(these days, I mostly program to automate a lot of painful data
crunching tasks that would take ages to do by hand), so some of this is
a bit beyond me...
Chuck - thanks. It's too bad that the formula stuff isn't implemented
yet, but could there be some clever workarounds to force or trick excel
into evaluating?
--
Posted via http://www.ruby-forum.com/.
[toc] | [prev] | [next] | [standalone]
| From | Mike Stephens <rubfor@recitel.net> |
|---|---|
| Date | 2011-05-20 16:36 -0500 |
| Subject | Matz never said Microsoft was the Devil Incarnate. (or did he?) |
| Message-ID | <3f9811841b309bc9010c0a84ed85bf8b@ruby-forum.com> |
| In reply to | #4768 |
Will I'm still fascinated why you are doing sophisticated things with Excel (not Open Office) but steadfastly refuse to load it on your computer. Windows and Excel can be purchased for the price of a monitor. You gain ownership of software that costs hundreds and hundreds of millions to develop. Why fanny around with some Micky Mouse spreadsheet gem when you can have the Full Monty? -- Posted via http://www.ruby-forum.com/.
[toc] | [prev] | [next] | [standalone]
| From | Daniel Berger <djberg96@gmail.com> |
|---|---|
| Date | 2011-05-20 17:02 -0500 |
| Subject | Re: Matz never said Microsoft was the Devil Incarnate. (or did he?) |
| Message-ID | <2429f4a7-c967-4a64-8637-ed75f4e5a313@q14g2000prh.googlegroups.com> |
| In reply to | #4839 |
On May 20, 3:36 pm, Mike Stephens <rub...@recitel.net> wrote: > Will > > I'm still fascinated why you are doing sophisticated things with Excel > (not Open Office) but steadfastly refuse to load it on your computer. > Windows and Excel can be purchased for the price of a monitor. You gain > ownership of software that costs hundreds and hundreds of millions to > develop. > > Why fanny around with some Micky Mouse spreadsheet gem when you can have > the Full Monty? Even if he had it installed locally, I'm guessing that he would want to generate the document in code since generating it by hand would be cumbersome. In addition, the spreadsheet gem works on any platform (last I checked). Regards, Dan
[toc] | [prev] | [next] | [standalone]
| From | Will James <ampclj9@hotmail.com> |
|---|---|
| Date | 2011-05-20 21:28 -0500 |
| Subject | Re: Matz never said Microsoft was the Devil Incarnate. (or did he?) |
| Message-ID | <03bd9fccf3fedba427f3c8295203e426@ruby-forum.com> |
| In reply to | #4841 |
Daniel Berger wrote in post #999984: > On May 20, 3:36pm, Mike Stephens <rub...@recitel.net> wrote: >> Will >> >> I'm still fascinated why you are doing sophisticated things with Excel >> (not Open Office) but steadfastly refuse to load it on your computer. >> Windows and Excel can be purchased for the price of a monitor. You gain >> ownership of software that costs hundreds and hundreds of millions to >> develop. >> >> Why fanny around with some Micky Mouse spreadsheet gem when you can have >> the Full Monty? > > Even if he had it installed locally, I'm guessing that he would want > to generate the document in code since generating it by hand would be > cumbersome. In addition, the spreadsheet gem works on any platform > (last I checked). > > Regards, > > Dan Yep, that's correct - I want the scripts to work across a variety of platforms, with as little dependence on outside applications and libraries as possible. This is partly because the scripts I'm writing may be used by a few others; I don't know about what software they will or won't have on their systems, and they will likely not be too willing to resolve too many dependency issues. I do have office installed on one of my systems, but don't have access to that one right now, and will not buy another copy just for this task. The spreadsheet gem meets the above requirements, and it was working brilliantly until I got to writing formulas to spreadsheets. -- Posted via http://www.ruby-forum.com/.
[toc] | [prev] | [next] | [standalone]
| From | Mike Stephens <rubfor@recitel.net> |
|---|---|
| Date | 2011-05-21 16:14 -0500 |
| Subject | Re: Matz never said Microsoft was the Devil Incarnate. (or did he?) |
| Message-ID | <c0d964c7b0873532faf67205705cc397@ruby-forum.com> |
| In reply to | #4847 |
Chad Perrin wrote in post #1000098: > and frankly, you shouldn't have to explain why you're writing code > for something like this, unless it's actually relevant to the problem > you want help solving. Chad, if you ever want to learn anything,and my experience of you -like others before me - is you don't, learn this: it is always vital to understand why you are doing something. -- Posted via http://www.ruby-forum.com/.
[toc] | [prev] | [next] | [standalone]
| From | Damjan Rems <d_rems@yahoo.com> |
|---|---|
| Date | 2011-05-23 15:18 -0500 |
| Subject | Re: Matz never said Microsoft was the Devil Incarnate. (or did he?) |
| Message-ID | <d6cefed2e3c20104578ae1855ca07662@ruby-forum.com> |
| In reply to | #4873 |
Just my 5 cents. What do you need formulas for. Is your data going to be changed by hand in the future? If not, why not calculate it by your program. by TheR -- Posted via http://www.ruby-forum.com/.
[toc] | [prev] | [next] | [standalone]
| From | Will James <ampclj9@hotmail.com> |
|---|---|
| Date | 2011-05-24 11:45 -0500 |
| Subject | Re: Matz never said Microsoft was the Devil Incarnate. (or did he?) |
| Message-ID | <c61b1bca43db88dc6e58971178610917@ruby-forum.com> |
| In reply to | #4947 |
Damjan Rems wrote in post #1000470: > Just my 5 cents. What do you need formulas for. Is your data going to be > changed by hand in the future? > > If not, why not calculate it by your program. > > by > TheR I thought about doing it this way, but the spreadsheet will have calculations based on previous calculations, based on previous calculations, and so on, so it's good to have the formulas in there, in part so that whoever is viewing the formulas can follow the process of how something is derived (without too much effort), and so that the viewer can verify that nothing went wrong anywhere in the process of deriving the final values. Basically, the formulas are good for transparency, in this case. -- Posted via http://www.ruby-forum.com/.
[toc] | [prev] | [next] | [standalone]
| From | Mike Stephens <rubfor@recitel.net> |
|---|---|
| Date | 2011-05-23 16:38 -0500 |
| Subject | Re: Matz never said Microsoft was the Devil Incarnate. (or did he?) |
| Message-ID | <3a0ee23606943f18e0ac9bd52688ff7c@ruby-forum.com> |
| In reply to | #4873 |
Chad Perrin wrote in post #1000266: > but it is *not* vital to explain to some > Microsoft obsessed shitbird why you are using Ruby to interact with an > XLS file rather than doing it "by hand" in Excel. The trouble with you Chad is you always manage to miss the point. No-one on this thread has mentioned doing it by hand. The issue was whether or not to use Windows OLE rather than a Linux environment, given that the end-product is for Windows users, and that it is does what Will wants - unlike his Linux solution. I'm not Microsoft obsessed. The simple fact is it is the Linga Franca of the computing world. Linux is only on a tiny minority of desktops. So it's natural to question why someone would choose to go down a such a route when Windows is what most other people would be using. Will has said his colleagues just happen to be avid Linux fans so that's fair enough. That answers the question. I know on this channel I will get the anti-Microsoft lobby. Fortunately I don't get it at work. Professional programmers grudgingly accept that NET has bugs and the usual MS baggage but probably is a better bet than say Java for mainstream e-business. Sadly people rarely have an opinion on Ruby. -- Posted via http://www.ruby-forum.com/.
[toc] | [prev] | [next] | [standalone]
| From | Michal Suchanek <hramrach@centrum.cz> |
|---|---|
| Date | 2011-05-23 18:00 -0500 |
| Subject | Re: Matz never said Microsoft was the Devil Incarnate. (or did he?) |
| Message-ID | <BANLkTikyZpZPb0ZA1inRG31SWhnt0HGwbg@mail.gmail.com> |
| In reply to | #4950 |
On 23 May 2011 23:38, Mike Stephens <rubfor@recitel.net> wrote: > Chad Perrin wrote in post #1000266: >> but it is *not* vital to explain to some >> Microsoft obsessed shitbird why you are using Ruby to interact with an >> XLS file rather than doing it "by hand" in Excel. > > The trouble with you Chad is you always manage to miss the point. You too. > > No-one on this thread has mentioned doing it by hand. The issue was > whether or not to use Windows OLE rather than a Linux environment, given > that the end-product is for Windows users, and that it is does what Will > wants - unlike his Linux solution. Not necessarily, the spreadsheets can be used on a variety of systems all of which can read them. Now I would choose a different file format but if part of the target users want to open the files in Excel or another spreadsheet this might be the most suitable format for the purpose. CSV or HTML works too but importing into a spreadsheet is somewhat problematic. > > I'm not Microsoft obsessed. The simple fact is it is the Linga Franca of > the computing world. Linux is only on a tiny minority of desktops. So Maybe where you work. I would guesstimate Windows being on about half of computers in the world. That's something that should be taken into consideration but not taken for granted. > it's natural to question why someone would choose to go down a such a > route when Windows is what most other people would be using. > > Will has said his colleagues just happen to be avid Linux fans so that's > fair enough. > That answers the question. I did not see anything about them being avid Linux fans. If you did not notice there are things like Windows without MS Office installed, OS X, even PDAs and tablets that can run Ruby but not MS Office OLE. > > I know on this channel I will get the anti-Microsoft lobby. Fortunately > I don't get it at work. Professional programmers grudgingly accept that > .NET has bugs and the usual MS baggage but probably is a better bet than > say Java for mainstream e-business. Sadly people rarely have an opinion > on Ruby. I don't know what you mean by e-business. If you mean serving web pages then I would rather rely on Java then .NET for the purpose. Regards Michal
[toc] | [prev] | [next] | [standalone]
| From | Mike Stephens <rubfor@recitel.net> |
|---|---|
| Date | 2011-05-24 12:45 -0500 |
| Subject | Keep your options open |
| Message-ID | <1b46fa6bba3375bf4651190d747529c7@ruby-forum.com> |
| In reply to | #4953 |
Michal Suchanek wrote in post #1000501: > I would guesstimate Windows being on about half > of computers in the world. > even PDAs and tablets that can run Ruby but not MS Office OLE. According to this http://marketshare.hitslink.com/operating-system-market-share.aspx?qprid=10 90% of computers run Windows, so normally you'd stand a fair chance of your program working if you used OLE. > I don't know what you mean by e-business. If you mean serving web > pages then I would rather rely on Java then .NET for the purpose. I'm not saying I'm right or that MS is better. I'm just saying there are a lot of people in my world (eg web apps for customers to service 120,000 loans; websites to sell international health insurance etc) and they just don't have this slightly puerile anti-microsoft attitude, so I'm confused why a few people on here cannot help themselves from making snide remarks whenever MS is mentioned. -- Posted via http://www.ruby-forum.com/.
[toc] | [prev] | [next] | [standalone]
| From | Johnny Morrice <spoon@killersmurf.com> |
|---|---|
| Date | 2011-05-24 13:22 -0500 |
| Subject | Re: Keep your options open |
| Message-ID | <20110524192238.402c173e@killersmurf.com> |
| In reply to | #5003 |
> I'm not saying I'm right or that MS is better. I'm just saying there > are a lot of people in my world (eg web apps for customers to service > 120,000 loans; websites to sell international health insurance etc) > and they just don't have this slightly puerile anti-microsoft > attitude, so I'm confused why a few people on here cannot help > themselves from making snide remarks whenever MS is mentioned. Before my unbelieving eyes, you have transformed a discussion on using ruby into an operating system flame war. Now that's magic! Do you do parties?
[toc] | [prev] | [next] | [standalone]
| From | Stu <stu@rubyprogrammer.net> |
|---|---|
| Date | 2011-05-24 16:55 -0500 |
| Subject | Re: Keep your options open |
| Message-ID | <BANLkTim1=-+ftTksev6KTEjDetDus4945Q@mail.gmail.com> |
| In reply to | #5003 |
x11 is not an operating system. FreeBSD is not even on that list. If your gonna link analysis and statistic web at least link one that has been around since before the bubble. http://news.netcraft.com/archives/2011/01/05/most-reliable-hosting-company-sites-in-december-2010.html As for referring to your peers as childish within your remark about M$ hate. Seriously if you don't know what the problem is at this point you really should reevaluate some of this cognitive dissonance so you wont be spewing bullshit like over 90% computer in the whole world run x,y,z OS. On Tue, May 24, 2011 at 12:45 PM, Mike Stephens <rubfor@recitel.net> wrote: > Michal Suchanek wrote in post #1000501: >> I would guesstimate Windows being on about half >> of computers in the world. >> even PDAs and tablets that can run Ruby but not MS Office OLE. > > According to this > http://marketshare.hitslink.com/operating-system-market-share.aspx?qprid=10 > > 90% of computers run Windows, so normally you'd stand a fair chance of > your program working if you used OLE. > >> I don't know what you mean by e-business. If you mean serving web >> pages then I would rather rely on Java then .NET for the purpose. > > I'm not saying I'm right or that MS is better. I'm just saying there are > a lot of people in my world (eg web apps for customers to service > 120,000 loans; websites to sell international health insurance etc) and > they just don't have this slightly puerile anti-microsoft attitude, so > I'm confused why a few people on here cannot help themselves from making > snide remarks whenever MS is mentioned. > > -- > Posted via http://www.ruby-forum.com/. > >
[toc] | [prev] | [next] | [standalone]
| From | Christopher Dicely <cmdicely@gmail.com> |
|---|---|
| Date | 2011-05-23 20:53 -0500 |
| Subject | Re: Matz never said Microsoft was the Devil Incarnate. (or did he?) |
| Message-ID | <BANLkTin-ybobmAu=XJFZ707ZwrVF6s+D=g@mail.gmail.com> |
| In reply to | #4950 |
On Mon, May 23, 2011 at 2:38 PM, Mike Stephens <rubfor@recitel.net> wrote: > > I know on this channel I will get the anti-Microsoft lobby. Fortunately > I don't get it at work. Professional programmers grudgingly accept that > .NET has bugs and the usual MS baggage but probably is a better bet than > say Java for mainstream e-business. Well, except that plenty of professional programmers come to the exact opposite conclusion wrt the relative desirability of .NET and Java for mainstream e-business.
[toc] | [prev] | [next] | [standalone]
| From | Colin Bartlett <colinb2r@googlemail.com> |
|---|---|
| Date | 2011-05-25 10:27 -0500 |
| Subject | Re: Matz never said Microsoft was the Devil Incarnate. (or did he?) |
| Message-ID | <BANLkTi=EZ01+W3jfCiKUq6+DSDUfo4bVLA@mail.gmail.com> |
| In reply to | #4847 |
On Sat, May 21, 2011 at 3:28 AM, Will James <ampclj9@hotmail.com> wrote: > Daniel Berger wrote in post #999984: >> On May 20, 3:36pm, Mike Stephens <rub...@recitel.net> wrote: >>> I'm still fascinated why you are doing sophisticated things with Excel >>> (not Open Office) but steadfastly refuse to load it on your computer. >>> Windows and Excel can be purchased for the price of a monitor. You gain >>> ownership of software that costs hundreds and hundreds of millions to >>> develop. >> >> Even if he had it installed locally, I'm guessing that he would want >> to generate the document in code since generating it by hand would be >> cumbersome. > > Yep, that's correct - I want the scripts to work across a variety of > platforms, with as little dependence on outside applications and > libraries as possible. This is partly because the scripts I'm writing > may be used by a few others; I don't know about what software they will > or won't have on their systems, and they will likely not be too willing > to resolve too many dependency issues. I do have office installed on one > of my systems, but don't have access to that one right now, and will not > buy another copy just for this task. There are other use cases for what you want to do, which is why I'm interested in any problems you come across and any ways you solve them. For example: I distrust spreadsheets for making important calculations (too easy to make errors in obscure cells without noticing), but they are very useful for displaying data. So I make some calculations using Ruby (or whatever), and then display the results on a worksheet page, using formulas to generate some of the displayed results for the same reasons you give in a later post "it's good to have the formulas in there, in part so that whoever is viewing the formulas can follow the process of how something is derived (without too much effort)". An important part of what I'm doing is that the worksheets will be usable in even quite old versions of Excel, so I only want to use elementary features of Excel. Actually, the original version of this used Microsoft Excel VisualBasic for Applications, with all the calculations being done in VBA, and using VBA to generate the worksheet pages. But I'd rather use Ruby for the calculations, so I'm currently rewriting it, hence my interest in what you're doing. I'm assuming you've looked at things like this http://www.cpearson.com/excel/optimize.htm which has a section on using VBA to force calculations: I haven't tried adapting the VBA code to run from Ruby accessing Excel, but it should be possible? As a very orthogonal suggestion: one thing that was worrying me about my approach was what if I couldn't manage to get Ruby to write anything directly into Excel. (You haven't got that problem.) But a possible solution occurred to me: use Ruby (or whatever) to generate a text file which has a list of cells and values or formulas (and formatting) to be entered into (or used by) each cell. Then write a VBA function to read such text files and generate the worksheet(s): a little messy, but fairly easy to do, and I was much happier once I had a backup plan if directly accessing Excel through Ruby didn't work.
[toc] | [prev] | [next] | [standalone]
Page 1 of 2 [1] 2 Next page →
Back to top | Article view | comp.lang.ruby
csiph-web