Hi k.misha,
On Thu, Apr 18, 2013 at 11:00:00PM +0300, k.misha wrote:
> Hi!
>
>
>
> I have a problem using this code:
>
>
>
> #define S_CURRENCY 106 // DOESN'T WORK =(
>
> #define S_PERCENT_SHORT 10 // 123%
>
> #define S_PERCENT 11 //123.00%
>
> #define S_DEFAULT 0
>
>
>
>
>
> Reference< XSpreadsheet > rSpSheet (rSheet, UNO_QUERY);
>
> Reference< XCell > rCell = rSpSheet->getCellByPosition(0, 0);
>
> Reference< XPropertySet > xPropSet(rCell, UNO_QUERY);
>
>
>
>
> xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("NumberForma
> t")), makeAny(S_CURRENCY));
>
>
>
>
>
> All other properties(S_PERCENT_SHORT,S_PERCENT,S_DEFAULT) works
> greatly! Only currency doesn't work =( What I'm doing wrong?
These constants are bad, you should use the number formats API:
http://wiki.openoffice.org/wiki/Documentation/DevGuide/OfficeDev/Number_Formats
"Number formats are defined on the document level. A document displaying
formatted values has a collection of number formats, each with a unique
index key within that document. Identical formats are not necessarily
represented by the same index key in different documents."
Note the "not necessarily". This means, you have to use
http://www.openoffice.org/api/docs/common/ref/com/sun/star/util/XNumberFormats.html
http://www.openoffice.org/api/docs/common/ref/com/sun/star/util/XNumberFormatTypes.html
as explained here
http://wiki.openoffice.org/wiki/Documentation/DevGuide/OfficeDev/Managing_Number_Formats
See the code attached for an example.
Regards
--
Ariel Constenla-Haile
La Plata, Argentina
|
Mime |
- Unnamed multipart/signed (inline, None, 0 bytes)
- Unnamed multipart/mixed (inlin, None, 0 bytes)
|