Hi Ralf, I forgot, could you please provide a patch with a test case that runs your example, so we can easily debug the functionality? With this it is far easier to answer your questions in greater detail!
Thanks in advance, Svante On Thu, Apr 21, 2016 at 8:40 AM, Svante Schubert <[email protected]> wrote: > Hello Ralf, > > Can you open an issue and attach the document? We could open it in various > office versions, create the same feature by application by hand and finally > take a look into the spec: > http://docs.oasis-open.org/office/v1.2/OpenDocument-v1.2-part1.html > If you do it yourself it might be quickest ;) > > Cheers, > Svante > On Apr 6, 2016 11:56 PM, "Ralf Heydenreich" <[email protected]> wrote: > >> Hi all, >> I've just created a spreadsheet with some currency values: >> >> protected void setCellValueAsLocalCurrency( int row, int column, >> MonetaryAmount d) { >> Cell cell = CellFormatter.getCell(spreadsheet, row, column); >> cell.setCurrencyValue(d.getNumber().doubleValue(), >> d.getCurrency().getCurrencyCode()); >> } >> >> The cell is created correctly, the type of the cell is also correct >> (currency), but if I open the spreadsheet in LibreOffice the numbers are >> displayed only as numbers, without currency symbol. If I format the cell >> with LibreOffice as "Currency", then the cell value changes to a text >> value with currency sign (but the cell type remains "currency"). >> >> Just an example. >> >> Somewhere in my program code... >> >> setCellValueAsLocalCurrency(12, 9, {EUR 0.35}); >> // the latter param is a javax.money.MonetaryAmount object >> >> The ODF-Toolkit creates: >> >> <table:table-cell office:currency="EUR" office:value="0.35" >> office:value-type="currency" table:style-name="a141ba1"/> >> >> LibreOffice displays only >> >> 0,35 >> >> (German localization) >> >> Now, if I change the formatting of this cell to "Currency" (in >> LibreOffice), the content changes to >> >> <table:table-cell table:style-name="ce8" office:value-type="currency" >> office:currency="EUR" office:value="0.35" >> calcext:value-type="currency"><text:p>0,35 €</text:p></table:table-cell> >> >> (Btw., why is the style-name changing?) >> >> As you can see, a new attribute is added: calcext:value-type="currency" >> And the content changes to <text:p>0,35 €</text:p> >> >> calcext is defined in styles.xml: >> >> xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" >> >> >> "experimental" doesn't sound good for production environments, I think... >> >> Now I want to know if this is a bug in ODF toolkit or if it only occurs >> in LibreOffice (using version 5.0.3.2). I think I could provide a patch >> if some changes are needed, but I want to get a clear vision of that :-) >> >> Regards, >> Ralf. >> >
