HowTo Customize Number Formats

View: New views
4 Messages — Rating Filter:   Alert me  

Re: HowTo Customize Number Formats

by Ariel Constenla-Haile :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Irné,

On Thursday 22 October 2009, 11:44, Irné Barnard wrote:

> I'm trying to create some custom number formats for calc. In particular
> to fix issue 5930. I've already created some add-on functions to
> "format" numbers by converting them to strings and back. I'd like to
> create an extra format type (instead of conversion functions) in the
> properties dialog so the user could select this, instead of modifying
> the formula.
>
> Unfortunately this would be my first attempt at this level of extension
> to OOo. Going through the API documentation I'm a bit confused by the
> *Number Format**** services, interfaces & constant.

the API specification is that, an specification, and so abstract. But it you go
to the specification for example
http://api.openoffice.org/docs/common/ref/com/sun/star/util/NumberFormats.html 
you'll find links to the Developer's Guide

http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/OfficeDev/Number_Formats

where things are explained in detail (at least on this case)

> It appears to be
> impossible to add another number format type.

yes, it is possible (but at document level, as stated in the Dev's Guide).

Regards
--
Ariel Constenla-Haile
La Plata, Argentina

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


HowTo Customize Number Formats

by Irné Barnard :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm trying to create some custom number formats for calc. In particular
to fix issue 5930. I've already created some add-on functions to
"format" numbers by converting them to strings and back. I'd like to
create an extra format type (instead of conversion functions) in the
properties dialog so the user could select this, instead of modifying
the formula.

Unfortunately this would be my first attempt at this level of extension
to OOo. Going through the API documentation I'm a bit confused by the
*Number Format**** services, interfaces & constant. It appears to be
impossible to add another number format type.

The one I want to add most is Engineering Format, which would be a
variant on Scientific Format = 32. Could someone please give me an
indication of how to go about this, or even if I'm on the right track.
I'd prefer to write the extension in Java / sBasic ... but if needs must
I can flip to C++, will just have to dust off that 10 year old part of
my brain :-D .

--
Regards Irné Barnard

Re: HowTo Customize Number Formats

by Irné Barnard :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ariel Constenla-Haile wrote:

> The API specification is that, an specification, and so abstract. But
> it you go
> to the specification for example
> http://api.openoffice.org/docs/common/ref/com/sun/star/util/NumberFormats.html 
> you'll find links to the Developer's Guide
>
> http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/OfficeDev/Number_Formats
>
> where things are explained in detail (at least on this case)
>
>  
>> It appears to be impossible to add another number format type.
>>    
>
> yes, it is possible (but at document level, as stated in the Dev's Guide).
>
> Regards
>  
Hello Ariel

Thanks for the extra info. So you're saying the only way would be to
create a custom format in the ODS file itself? In which case, does the
extended format also need to be an embedded macro?

--
Regards Irné Barnard

Re: HowTo Customize Number Formats

by Ariel Constenla-Haile :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Irné,

On Thursday 22 October 2009, 13:00, Irné Barnard wrote:

> > The API specification is that, an specification, and so abstract. But
> > it you go
> > to the specification for example
> > http://api.openoffice.org/docs/common/ref/com/sun/star/util/NumberFormats
> >.html you'll find links to the Developer's Guide
> >
> > http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/OfficeDev
> >/Number_Formats
> >
> > where things are explained in detail (at least on this case)
> >
> >> It appears to be impossible to add another number format type.
> >
> > yes, it is possible (but at document level, as stated in the Dev's
> > Guide).
>
> Thanks for the extra info. So you're saying

I'm just saying "go study the Developer's Guide!"... no, just kidding (though
hope you study it)

> the only way would be to
> create a custom format in the ODS file itself?

custom number formats are stored inside the document (that's all I know from
the Dev's Guide, and AFAIK that hasn't changed)

> In which case, does the
> extended format also need to be an embedded macro?

no, no marco needed; but you need a way to store the format in every OOo
document you want to use that format.
One way could be to develop a css.task.Job that will be invoked
onDocumentOpened (== OnNew + OnLoad), check if the document already has the
num. format, and if not then add it.

Regards
--
Ariel Constenla-Haile
La Plata, Argentina

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...