OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Compute from a group of Cells

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
SergeM
Super User
Super User


Joined: 09 Sep 2003
Posts: 3211
Location: Troyes France

PostPosted: Sat Nov 15, 2003 8:40 am    Post subject: Compute from a group of Cells Reply with quote

When I read the SUN documentation on OooBasic programming I see that only the functions :
SUM, COUNT,COUNTNUMS,MAX,MIN,PRODUCT,STDEV,VAR,VARP,STDEVP can be computed with a :
Code:
oGroup.computeFunction(com.sun.star.sheet.GeneralFunction.XXXX)

Is it realy true ?
I can't test it because I have a french version of Ooo and I don't know exacly the names of the english functions ...
Yes I understand now during the redaction of this question.
It's probably true because the others funtions don't work with a group of cells.
Then I ask an other question. Is there a way to compute the other functions without using a
Code:
oCell.Formula="=SUM....."

I mean without using a cell of a sheet but obtaining directly the result in a OooBASIC variable ? (For example CROSSCORRELATION : sorry I don't know the english name of COVARIANCE)

To explain my problem with french and english name to the people who use only an english version of Ooo : with a french version you write in OooBASIC
Code:
oGroup.computeFunction(com.sun.star.sheet.GeneralFunction.SUM)

with the english name but
Code:
oCell.Formula="=SOMME....."

with the french name ....
I have not already try to give this second line to an english version of Ooo but i suspect that it doesn't work.
_________________
Linux & Windows OOo3.0
UNO & C++ : WIKI
http://wiki.services.openoffice.org/wiki/Using_Cpp_with_the_OOo_SDK
In French
http://wiki.services.openoffice.org/wiki/Documentation/FR/Cpp_Guide
Back to top
View user's profile Send private message Visit poster's website
SergeM
Super User
Super User


Joined: 09 Sep 2003
Posts: 3211
Location: Troyes France

PostPosted: Sat Nov 15, 2003 9:58 am    Post subject: Reply with quote

I have understood something since i post the previous message : the difference between oCell.Formula and oCell.FormulaLocal. Then there is a mistake in the previous post.

It's not

Code:
Cell.Formula="=SOMME....."

with french name ....

but

Code:
Cell.FormulaLocal="=SOMME....."

with french name ....

I then discover this possibility to use only english names. Is then the code more portable ?
How does work a program with
Code:
Cell.FormulaLocal="=SOMME....."

with an english version of OOo ?
[/code]
_________________
Linux & Windows OOo3.0
UNO & C++ : WIKI
http://wiki.services.openoffice.org/wiki/Using_Cpp_with_the_OOo_SDK
In French
http://wiki.services.openoffice.org/wiki/Documentation/FR/Cpp_Guide
Back to top
View user's profile Send private message Visit poster's website
dfrench
Moderator
Moderator


Joined: 03 Mar 2003
Posts: 1605
Location: Wellington, New Zealand

PostPosted: Sat Nov 15, 2003 3:34 pm    Post subject: Reply with quote

Quote:
How does work a program with
Code:
Cell.FormulaLocal="=SOMME....."

with an english version of OOo ?

The result same as entering the formula directly into a cell ... #NAME? error on the spreadsheet ... program executes fine.



Quote:
I don't know the english name of COVARIANCE
That will do fine in english as well Smile ... the function is COVAR().
I do not think that you can execute any spreadsheet functions other than those listed using com.sun.star.sheet.GeneralFunction.XXX.
The underlying formula is generally well documented so you could code it in Basic and refer to the cells containing the arguments but simply putting the function into the spreadsheet as you have done seems a simpler approach.
Back to top
View user's profile Send private message
SergeM
Super User
Super User


Joined: 09 Sep 2003
Posts: 3211
Location: Troyes France

PostPosted: Mon Nov 17, 2003 9:12 am    Post subject: Reply with quote

OK thank you for your answer. I will try with putting the function into the spreadsheet.
_________________
Linux & Windows OOo3.0
UNO & C++ : WIKI
http://wiki.services.openoffice.org/wiki/Using_Cpp_with_the_OOo_SDK
In French
http://wiki.services.openoffice.org/wiki/Documentation/FR/Cpp_Guide
Back to top
View user's profile Send private message Visit poster's website
SergeM
Super User
Super User


Joined: 09 Sep 2003
Posts: 3211
Location: Troyes France

PostPosted: Tue Nov 18, 2003 1:15 am    Post subject: Reply with quote

The OOoBasic code
Code:
oGroup.computeFunction(com.sun.star.sheet.GeneralFunction.VAR)

and
Code:
oGroup.computeFunction(com.sun.star.sheet.GeneralFunction.VARP)

and
Code:
oGroup.computeFunction(com.sun.star.sheet.GeneralFunction.STDEVP)

don't work. It returns me always 0
I have no problem with
Code:
oGroup.computeFunction(com.sun.star.sheet.GeneralFunction.MAX)
oGroup.computeFunction(com.sun.star.sheet.GeneralFunction.MIN)
oGroup.computeFunction(com.sun.star.sheet.GeneralFunction.AVERAGE)
oGroup.computeFunction(com.sun.star.sheet.GeneralFunction.SUM)


Any body to confirm or infirm ?
_________________
Linux & Windows OOo3.0
UNO & C++ : WIKI
http://wiki.services.openoffice.org/wiki/Using_Cpp_with_the_OOo_SDK
In French
http://wiki.services.openoffice.org/wiki/Documentation/FR/Cpp_Guide
Back to top
View user's profile Send private message Visit poster's website
dfrench
Moderator
Moderator


Joined: 03 Mar 2003
Posts: 1605
Location: Wellington, New Zealand

PostPosted: Thu Dec 11, 2003 5:11 am    Post subject: Reply with quote

http://www.openoffice.org/issues/show_bug.cgi?id=22625 now shown as started , target for release 2.0
Back to top
View user's profile Send private message
dfrench
Moderator
Moderator


Joined: 03 Mar 2003
Posts: 1605
Location: Wellington, New Zealand

PostPosted: Sun Feb 15, 2004 3:32 pm    Post subject: Reply with quote

see http://www.oooforum.org/forum/viewtopic.php?p=21960#21960 for a more general function implementation in java and basic
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group