| View previous topic :: View next topic |
| Author |
Message |
milek_pl General User

Joined: 02 Jul 2006 Posts: 13
|
Posted: Tue Oct 02, 2007 9:59 am Post subject: Calc Function in a Macro as an Extension |
|
|
Hi,
I'm trying to export a useful function (that spells the amount in words, in Polish) as a macro. However, I found out that Calc cannot find the function if it's not in the Standard Library, and this library, is, of course, not available for export.
What should I do to make this function available for Calc from other macro Library that I could export later as an extension?
Thanks in advance,
Marcin |
|
| Back to top |
|
 |
Danad OOo Advocate

Joined: 22 Feb 2004 Posts: 293 Location: Brasil
|
Posted: Tue Oct 02, 2007 12:14 pm Post subject: |
|
|
Hi,
You've two options:
1 - Install your macro (Basic) as a module of the Standard library. You'll find some code that automate this in: http://www.ooomacros.org
2- Write your function as an Add-in, but you can't use Basic. Here, in the Code Snippets topic, you'll find one Java add-in and The Developer's Guide cover this too.
HTH |
|
| Back to top |
|
 |
milek_pl General User

Joined: 02 Jul 2006 Posts: 13
|
Posted: Thu Oct 04, 2007 11:22 am Post subject: |
|
|
Thanks a lot. I only wanted to repackage an existing Calc add-on in Basic to the extension format, but as this seems not feasible, I won't dwelve into that.
I could translate this into Java some day, anyway.
Thanks for the info,
Marcin |
|
| Back to top |
|
 |
ms777 Super User


Joined: 07 Feb 2004 Posts: 1355
|
|
| Back to top |
|
 |
milek_pl General User

Joined: 02 Jul 2006 Posts: 13
|
Posted: Sat Oct 06, 2007 1:03 pm Post subject: |
|
|
Hi,
you can, but you cannot put the Standard library into it. The problem is that Calc doesn't see Basic functions outside of the Standard library...
oh well...
best,
Marcin |
|
| Back to top |
|
 |
Villeroy Super User


Joined: 04 Oct 2004 Posts: 10065 Location: Germany
|
Posted: Sat Oct 06, 2007 1:19 pm Post subject: |
|
|
You can not write a Basic add-in (collection of Calc functions) since you can not write classes implementing special interfaces. This is required for integration in the function wizzard (localized names, descriptions, argument descriptions).
It should be possible to write an add-on (collection of anything) which installs some module in MyMacros, lib "Standard".
For simplicity I would copy the Basic functions to lib "Standard" of the document/template where they are needed. |
|
| Back to top |
|
 |
milek_pl General User

Joined: 02 Jul 2006 Posts: 13
|
Posted: Sat Oct 06, 2007 1:38 pm Post subject: |
|
|
| Great, but an the add-on be put into an extension installable in oxt file? Any examples of that? |
|
| Back to top |
|
 |
Villeroy Super User


Joined: 04 Oct 2004 Posts: 10065 Location: Germany
|
Posted: Sat Oct 06, 2007 2:01 pm Post subject: |
|
|
I just had a look at Tools>Macros>Organize>Basic... [Organize...], Tab "Libraries", [Export...].
This allows you to export an entire Basic library as extension.oxt, BUT library "Standard" seems to be excluded. The export button is disabled when you pick "Standard". This indicates that you can package entire libraries except for "Standard", which is not allowed to be overwritten. But I did not read the specs. |
|
| Back to top |
|
 |
milek_pl General User

Joined: 02 Jul 2006 Posts: 13
|
Posted: Sat Oct 06, 2007 2:15 pm Post subject: |
|
|
| Well, the specs are a pain to read. Anyway, I also found this out in the GUI... There are good reasons not to allow overwriting the Standard library, so this should be in the specs. |
|
| Back to top |
|
 |
|