Re: Proper way to find an existing number format style.

Andrew Douglas Pitonyak <[email protected]> Tue, 31 May 2011 08:38:24 -0400
Newsgroups gmane.comp.openoffice.devel.api
Message-ID <[email protected]>

On 05/31/2011 05:37 AM, Niklas Nebel wrote:
> On 31.05.2011 07:34, Andrew Douglas Pitonyak wrote:
>> Tested on 3.3.0 en-US using the 64-bit Linux version on Fedora 15.
>>
>> I use the following macro to find an existing number format, and I
>> create it if it does not exist. The problem is that
>> oDoc.getNumberFormats().queryKey(sFormat, aLocale, True) fails to find
>> user created numeric formats, it only returns a value for for formats
>> strings contained in the document.
>
>> formats() =3D Array("0", "#,##0", "$#,##0.--;[RED]-$#,##0.--", "##0,0#=
\h",
>> "##0,0#\=C2=B0C", "#0,0#\W\h", "##0,0#\k\W\h")
>
> Assuming en-US locale settings, "##0,0#\h" with the thousands=20
> separator character is changed to "##,00#\h" in addNew, but not in=20
> queryKey. It's the same problem as in issue 38981 and 72380. You=20
> should try to use format strings that don't have to be modified.
>
> Niklas
Thank you very much...

Peter, if the macro fails with your locale, let me know and I will write=20
a macro that works around the problem.

--=20
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.odt
Info:  http://www.pitonyak.org/oo.php

--=20
-----------------------------------------------------------------
To unsubscribe send email to [email protected]
For additional commands send email to [email protected]
with Subject: help