Issue 127512 - textable: cell value is set to "0" on save if cell format does not match written cell value
Summary: textable: cell value is set to "0" on save if cell format does not match writ...
Status: CONFIRMED
Alias: None
Product: Writer
Classification: Application
Component: save-export (show other issues)
Version: 4.1.2
Hardware: All Windows, all
: P5 (lowest) Normal (vote)
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-08-17 08:32 UTC by Oliver Brinzing
Modified: 2017-08-17 12:54 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
writer_table_cell_format (12.17 KB, application/vnd.oasis.opendocument.text)
2017-08-17 08:32 UTC, Oliver Brinzing
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description Oliver Brinzing 2017-08-17 08:32:27 UTC
Created attachment 86205 [details]
writer_table_cell_format

steps to reproduce:

- open attached writer document
- press button
- cells C1,C2,C3 are filled with setString()
- save and reload
- values in C2,C3 are set to "0"/ "1899-12-30"

<table:table-cell table:style-name="Tabelle1.C2" 
                  office:value-type="float" 
                  office:value="0">
   <text:p text:style-name="P2">123,45</text:p>
</table:table-cell>

did not happen in aoo 401:

<table:table-cell table:style-name="Tabelle1.C2" office:value-type="string">
  <text:p text:style-name="P2">123,45</text:p>
</table:table-cell>
Comment 1 oooforum (fr) 2017-08-17 10:29:19 UTC
For me, input a number or a date must be set with Value property.
This code works as expected:
 oCell = oTable.getCellByName("C1")
 oCell.setString("Hello")
 oCell = oTable.getCellByName("C2")
 oCell.setValue("123.45")
 oCell = oTable.getCellByName("C3")
 oCell.setValue(dateValue("17/08/2017"))
Comment 2 Oliver Brinzing 2017-08-17 11:33:59 UTC
> For me, input a number or a date must be set with Value property.

sure, but if a user inputs a string value into cell c2/c3, 
the cell format will be (re)set to @ automatically, and the 
value will not get lost during save/reload.

so i would expect setString() will either throw an exception in 
that case, or behave as described above.
Comment 3 oooforum (fr) 2017-08-17 12:54:01 UTC
(In reply to Oliver Brinzing from comment #2)
> sure, but if a user inputs a string value into cell c2/c3, 
> the cell format will be (re)set to @ automatically, and the 
> value will not get lost during save/reload.
That's happen with UI but not through API

In Tools > Options > Writer > Table, we found:
Input in tables 
 [x] Number format recognition
So, a macro must take care of this parameter.