incubator-odf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Svante Schubert <svante.schub...@gmail.com>
Subject Re: setStringFormat doesn't always work as expected
Date Wed, 15 Jan 2014 19:04:11 GMT
Hi Nicholas,

would it possible to test the problem in the latest sources?
In addition could you provide an issue and attach a test case. Test
Driven Development, you know..

For ease of you, just take an existing one, so one of us might debug
into it, if the solution might not become apparent at once.
In general I feel more responsible for the lower classes than for the
Simple API that IBM once added.

Thanks in advance,
Svante


Am 14.01.2014 16:59, schrieb Nicholas Evans:
> Dear odf users,
>
> I am writing an application that makes use of the setFormatString function
> from the ODF Simple API (the 0.7-incubating version that is available
> through maven central).  My use case is the following:
>
> 1) I select a cell in the spreadsheet.
> 2) I set the style of this cell using setCellStyleName
> 3) I set a double value in the cell using setDoubleValue
> 4) I set a format for the cell using setFormatString
>
> When I test run this sequence in a simple test project it works fine.
> However, when I use the same sequence in a bigger spreadsheet, the cell is
> not rendered as it should be.  When I open the generated spreadsheet in
> LibreOffice and GoogleSpreadsheets, the cell is not formatted as I want,
> although the double value is displayed.  However, when I open the
> spreadsheet in Excel, the cell is formatted properly. If I save the file in
> excel and reopen it in LibreOffice, the cell is formatted correctly.
>
> I have compared the ods xml files before and after saving it in Excel and
> there are quite substantial differences in the way in the which the styles
> are handled.
>
> Interestingly, the following sequence produces different results in my
> small test project and my large project:
>
> 1) I select a cell in the spreadsheet.
> 2) I set the style of this cell using setCellStyleName
> 3) I set a double value in the cell using setDoubleValue
> 4) I set a format for the cell using setStringFormat
> 5) I get the cell style using getCellStyleName
>
> In the small project, the style I get in step 5 is different from the one I
> set in step 2. It seems that somewhere a new style is generated that is a
> child of the Default style and this is returned in step 5.  However, in the
> larger project, step 5 returns the style I set in step 2.
>
> It seems like the API is working at least partially correctly, because
> Excel can understand the generated spreadsheet.  However, it is rather
> frustrating that LibreOffice can only understand the spreadsheet after it
> has been through Excel.
>
> Has anyone experienced such a problem before?  Do you have any suggestions
> for how I could get the setFormatString to work?
>
> Thanks for your help.
>
> Kind regards,
>
> Nick
>


Mime
View raw message