Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


Hi Alex,

alex sato schrieb:
Regina, thanks for your answer.

But can you tell me how to call Calc functions inside the macro?
I searched in docs and in the Google and don't found any clue.

It is done with the service FunctionAccess, see http://api.libreoffice.org/docs/common/ref/com/sun/star/sheet/FunctionAccess.html and the there linked section in the Developers guide.

Here a very simple example, how it looks in Basic

function MYPRODUCT (byVal x as double,byVal y as double) as double
dim oFunction as variant
oFunction = createUnoService("com.sun.star.sheet.FunctionAccess")
dim aArgument(1) as variant
dim result as double
aArgument(0)=x
aArgument(1)=y
result = oFunction.callFunction( "PRODUCT", aArgument() )
MYPRODUCT = result
end function

If you search for createUnoService("com.sun.star.sheet.FunctionAccess") you will get a lot of relevant hits.


By the way, just now I tought the possibility to rewrite math functions
using "string" to encode the number to avoid error because I remembered
BCD.  :-)

What is your goal? There is no silver bullet that fits all problems, but perhaps you can get a helpful tip or trick.

Kind regards
Regina

--
For unsubscribe instructions e-mail to: users+help@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.