Apache OpenOffice (AOO) Bugzilla – Issue 127512
textable: cell value is set to "0" on save if cell format does not match written cell value
Last modified: 2017-08-17 12:54:01 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>
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"))
> 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.
(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.