Issue 120942

Summary: Cell Number format style is changed after saving to ods by AOO
Product: Calc Reporter: Li Feng Wang <phoenix.wanglf>
Component: open-importAssignee: AOO issues mailing list <issues>
Status: CONFIRMED --- QA Contact:
Severity: Normal    
Priority: P3 CC: concord268, elish, hanya.runo, rainerbielefeld_ooo_qa
Version: 4.0.0-devKeywords: ms_interoperability
Target Milestone: ---   
Hardware: All   
OS: All   
See Also: https://issues.apache.org/ooo/show_bug.cgi?id=123149
Issue Type: DEFECT Latest Confirmation in: 4.1.0-dev
Developer Difficulty: ---
Issue Depends on:    
Issue Blocks: 121014    
Attachments:
Description Flags
sample file none

Description Li Feng Wang 2012-09-13 06:41:35 UTC
Created attachment 79467 [details]
sample file

build:
AOO trunk r1381968

steps:
1)open sample file
2)check number format style in D65531
3)save to ods file
4)check number format style in D65531 too

defect:
number format style is changed, from ¥0300.000 to ¥300.000
Comment 1 Rainer Bielefeld 2013-08-31 11:22:22 UTC
I see several obscurities here, so back to UNCONFIRMED

a) Summary tells something concerning a save-export problem, but Component
   selction is "open-import"?
b) is this really a new 4.0.0 problem? I doubt
c) Because I did not understand all details here I submitted "Bug 123149 - "Add leading digits" formatting feature supported, but lost after save as .ods", what might describe the real roots of the observations here.
Comment 2 Edwin Sharp 2013-12-15 14:38:09 UTC
step 2) [BLUE]"¥"0#,##0.000;[RED]"¥"-0#,##0.000
step 4) [BLUE]"¥"#,#00.000;[RED]"¥-"#,#00.000

AOO410m1(Build:9750)  -  Rev. 1548193
2013-12-07_04:10:48 - Rev. 1548790
Debian
Comment 3 hanya 2013-12-15 15:27:17 UTC
Here are parts of stored styles in ods file that has the cell formatted with the format code in Comment 2.
From content.xml: 
   <table:table table:name="Sheet1" table:style-name="ta1" table:print="false">
    <table:table-column table:style-name="co1" table:default-cell-style-name="ce1"/>
    <table:table-row table:style-name="ro3">
     <table:table-cell office:value-type="float" office:value="100">
      <text:p>¥0100.000</text:p>
     </table:table-cell>
    </table:table-row>
   </table:table>

The cell formatted by "ce1" cell style and its this: 

<style:style style:name="ce1" style:family="table-cell" style:parent-style-name="Default" style:data-style-name="N111"/>

"N111" style is stored as follows: 

  <number:number-style style:name="N111P0" style:volatile="true">
   <style:text-properties fo:color="#0000ff"/>
   <number:text>¥</number:text>
   <number:number number:decimal-places="3" number:min-integer-digits="2" number:grouping="true"/>
  </number:number-style>
  <number:number-style style:name="N111">
   <style:text-properties fo:color="#ff0000"/>
   <number:text>¥-</number:text>
   <number:number number:decimal-places="3" number:min-integer-digits="2" number:grouping="true"/>
   <style:map style:condition="value()&gt;=0" style:apply-style-name="N111P0"/>
  </number:number-style>

The above style can reproduce [BLUE]"¥"#,#00.000;[RED]"¥-"#,#00.000 style but 
it can not be the original formatting.

From [BLUE]"¥"0#,##0.000;[RED]"¥"-0#,##0.000 style, "min-integer-digits" is compacted to sequential two zero.
It seems number:number element could not represent the original number format.
See 16.27.2 <number:number-style> section of ODF 1.2 specification for the element.