This is an automated email from the ASF dual-hosted git repository.

damjan pushed a commit to branch AOO41X
in repository https://gitbox.apache.org/repos/asf/openoffice.git

commit 4926b38203718cd102f6233580cc93e8f867c7b4
Author: Damjan Jovanovic <[email protected]>
AuthorDate: Fri Jan 13 18:27:50 2023 +0200

    Dates and times are loaded wrongly from SpreadsheetML files, because the 
filter
    loads only the date or time portion of the ss:DateTime based on the cell's
    style.
    
    Rather always load the ss:DateTime as our ODF office:date-value in the
    XMLSchema-2 dateTime format, with both its date and time part, and then 
rely on
    formatting to display only the date or time as desired.
    
    Fixes: #82849 - SpreadsheetML ss:DateTime cell value is loaded as either 
only
    a date or a time
    
    Patch by: Philip J. Turmel <[email protected]>
    Reviewed by: me
    
    (cherry picked from commit 0db4a4f44da1c0fb06154ba61c960a18427e751b)
---
 .../xslt/import/spreadsheetml/spreadsheetml2ooo.xsl    | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)

diff --git a/main/filter/source/xslt/import/spreadsheetml/spreadsheetml2ooo.xsl 
b/main/filter/source/xslt/import/spreadsheetml/spreadsheetml2ooo.xsl
index 3f93f105ae..63291ffa6d 100644
--- a/main/filter/source/xslt/import/spreadsheetml/spreadsheetml2ooo.xsl
+++ b/main/filter/source/xslt/import/spreadsheetml/spreadsheetml2ooo.xsl
@@ -6866,20 +6866,10 @@
                                        </xsl:attribute>
                                </xsl:when>
                                <xsl:when test="ss:Data/@ss:Type = 'DateTime'">
-                                       <xsl:choose>
-                                               <xsl:when test="(contains( 
$data-format, 'Date') or contains($data-format,'y') or 
contains($data-format,'g') or contains($data-format,'d') or 
contains($data-format,'e') or starts-with( substring( ss:Data, 11), 
'T00:00:00.000' ) ) and (not (contains( $data-format, 'Time') ) )">
-                                                       <xsl:attribute 
name="office:value-type">date</xsl:attribute>
-                                                       <xsl:attribute 
name="office:date-value">
-                                                               <xsl:value-of 
select="substring-before(ss:Data, 'T')"/>
-                                                       </xsl:attribute>
-                                               </xsl:when>
-                                               <xsl:otherwise>
-                                                       <xsl:attribute 
name="office:value-type">time</xsl:attribute>
-                                                       <xsl:attribute 
name="office:time-value">
-                                                               <xsl:value-of 
select="concat('P',substring(ss:Data, 11, 3), 'H', substring(ss:Data, 15, 2), 
'M', substring(ss:Data, 18,2), 'S')"/>
-                                                       </xsl:attribute>
-                                               </xsl:otherwise>
-                                       </xsl:choose>
+                                       <xsl:attribute 
name="office:value-type">date</xsl:attribute>
+                                       <xsl:attribute name="office:date-value">
+                                               <xsl:value-of 
select="substring(ss:Data, 1, 19)"/>
+                                       </xsl:attribute>
                                </xsl:when>
                                <xsl:when test="ss:Data/@ss:Type = 'Boolean'">
                                        <xsl:attribute 
name="office:value-type">boolean</xsl:attribute>

Reply via email to