Issue 115227 - Time value of DateTime cell is lost when loading Microsoft Excel 2003 XML(*.xml) file
Summary: Time value of DateTime cell is lost when loading Microsoft Excel 2003 XML(*.x...
Status: CLOSED DUPLICATE of issue 82849
Alias: None
Product: Calc
Classification: Application
Component: formatting (show other issues)
Version: OOO320m18
Hardware: Unknown Windows XP
: P3 Trivial with 2 votes (vote)
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-24 11:03 UTC by liyd
Modified: 2017-05-20 09:53 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description liyd 2010-10-24 11:03:22 UTC
Content of source file:
------------
<?xml version="1.0"?>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
 xmlns:o="urn:schemas-microsoft-com:office:office"
 xmlns:x="urn:schemas-microsoft-com:office:excel"
 xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
 xmlns:html="http://www.w3.org/TR/REC-html40">
 <DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
  <Author>liyd</Author>
  <LastAuthor>liyd</LastAuthor>
  <Created>2010-10-24T07:33:39Z</Created>
  <Company></Company>
 </DocumentProperties>
 <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
  <WindowHeight>11625</WindowHeight>
  <WindowWidth>19185</WindowWidth>
  <WindowTopX>0</WindowTopX>
  <WindowTopY>90</WindowTopY>
  <ProtectStructure>False</ProtectStructure>
  <ProtectWindows>False</ProtectWindows>
 </ExcelWorkbook>
 <Styles>
  <Style ss:ID="Default" ss:Name="Normal">
   <Alignment ss:Vertical="Center"/>
   <Borders/>
   <Font ss:FontName="sans-serif" ss:Size="11" ss:Color="#000000"/>
   <Interior/>
   <NumberFormat/>
   <Protection/>
  </Style>
  <Style ss:ID="s62">
   <NumberFormat ss:Format="Short Date"/>
  </Style>
  <Style ss:ID="s63">
   <NumberFormat ss:Format="h:mm:ss"/>
  </Style>
  <Style ss:ID="s64">
   <NumberFormat ss:Format="General Date"/>
  </Style>
 </Styles>
 <Worksheet ss:Name="Sheet1">
  <Table ss:ExpandedColumnCount="3" ss:ExpandedRowCount="4" x:FullColumns="1"
   x:FullRows="1" ss:DefaultColumnWidth="54" ss:DefaultRowHeight="13.5">
   <Column ss:Index="3" ss:Width="110.25"/>
   <Row ss:Index="2">
    <Cell ss:Index="3" ss:StyleID="s62"><Data
ss:Type="DateTime">2010-10-24T00:00:00.000</Data></Cell>
   </Row>
   <Row>
    <Cell ss:Index="3" ss:StyleID="s63"><Data
ss:Type="DateTime">1899-12-31T15:33:52.000</Data></Cell>
   </Row>
   <Row>
    <Cell ss:Index="3" ss:StyleID="s64"><Data
ss:Type="DateTime">2010-10-24T15:33:58.000Z</Data></Cell>
   </Row>
  </Table>
  <WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
   <PageSetup>
    <Header x:Margin="0.3"/>
    <Footer x:Margin="0.3"/>
    <PageMargins x:Bottom="0.75" x:Left="0.7" x:Right="0.7" x:Top="0.75"/>
   </PageSetup>
   <Selected/>
   <Panes>
    <Pane>
     <Number>3</Number>
     <ActiveRow>4</ActiveRow>
     <ActiveCol>2</ActiveCol>
    </Pane>
   </Panes>
   <ProtectObjects>False</ProtectObjects>
   <ProtectScenarios>False</ProtectScenarios>
  </WorksheetOptions>
 </Worksheet>
 <Worksheet ss:Name="Sheet2">
  <Table ss:ExpandedColumnCount="1" ss:ExpandedRowCount="1" x:FullColumns="1"
   x:FullRows="1" ss:DefaultColumnWidth="54" ss:DefaultRowHeight="13.5">
  </Table>
  <WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
   <PageSetup>
    <Header x:Margin="0.3"/>
    <Footer x:Margin="0.3"/>
    <PageMargins x:Bottom="0.75" x:Left="0.7" x:Right="0.7" x:Top="0.75"/>
   </PageSetup>
   <ProtectObjects>False</ProtectObjects>
   <ProtectScenarios>False</ProtectScenarios>
  </WorksheetOptions>
 </Worksheet>
 <Worksheet ss:Name="Sheet3">
  <Table ss:ExpandedColumnCount="1" ss:ExpandedRowCount="1" x:FullColumns="1"
   x:FullRows="1" ss:DefaultColumnWidth="54" ss:DefaultRowHeight="13.5">
  </Table>
  <WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
   <PageSetup>
    <Header x:Margin="0.3"/>
    <Footer x:Margin="0.3"/>
    <PageMargins x:Bottom="0.75" x:Left="0.7" x:Right="0.7" x:Top="0.75"/>
   </PageSetup>
   <ProtectObjects>False</ProtectObjects>
   <ProtectScenarios>False</ProtectScenarios>
  </WorksheetOptions>
 </Worksheet>
</Workbook>
------------

Using XCell#getFormula() to get formula of cell[C2,C3,C4], and get result:
------------
40475
0.648518518518519
40475
------------

Code to fetch applied format string:
------------
XTextFieldsSupplier text = (XTextFieldsSupplier)
UnoRuntime.queryInterface(XTextFieldsSupplier.class, XCell);
XPropertySet propetySet = (XPropertySet)
UnoRuntime.queryInterface(XPropertySet.class, text);
int nIndexKey =	((Integer) propetySet.getPropertyValue("NumberFormat")).intValue();
com.sun.star.beans.XPropertySet xProp =	numberFormats.getByKey(nIndexKey);
String formatString = (String) xProp.getPropertyValue("FormatString");
System.out.println("FormatString: '" + formatString + "'");
-------------
and get result:
-------------
FormatString: 'D-M-YY'
FormatString: 'H:MM:SS'
FormatString: 'YYYY-M-D H:MM'
-------------

So the DateTime format is recognized, but the value is wrong.
Value of C4 is supposed to be 40475.648587962962963, but actually is 40475.

The bug can be detected by the following way:
1.create a new calc spreadsheet, create a DateTime cell.
2.save it in type "Microsoft Excel 2003 XML(.xml)".
3.open the xml file using text edit, the value is correct.
4.open the xml file using calc, and the time part is lost.
Comment 1 liyd 2010-10-25 13:48:48 UTC
duplicate of issue#82849
http://qa.openoffice.org/issues/show_bug.cgi?id=82849

This problem can be fixed by applying a patch to spreadsheetml2ooo.xsl filter.
Comment 2 Rob Weir 2013-03-11 15:01:10 UTC
I'm adding this comment to all open issues with Issue Type == PATCH.  We have 220 such issues, many of them quite old.  I apologize for that.  

We need your help in prioritizing which patches should be integrated into our next release, Apache OpenOffice 4.0.

If you have submitted a patch and think it is applicable for AOO 4.0, please respond with a comment to let us know.

On the other hand, if the patch is no longer relevant, please let us know that as well.

If you have any general questions or want to discuss this further, please send a note to our dev mailing list:  dev@openoffice.apache.org

Thanks!

-Rob
Comment 3 Edwin Sharp 2014-01-16 13:49:04 UTC
Duplicate per comment 1

*** This issue has been marked as a duplicate of issue 82849 ***