Apache OpenOffice (AOO) Bugzilla – Issue 128567
References to columns above 676 are wrong when importing XML files
Last modified: 2023-03-25 16:06:51 UTC
Created attachment 87177 [details] Example file demonstrating the error. File spreadsheetml2ooo.xsl has already been patched in version 4.1.14 (Issue 81233) but now references columns above 676 are wrong. Below is a patch for spreadsheetml2ooo.xsl replacing templates translate-unit and number-to-character. Files uof2odf.xsl and uof2odf_spreadsheet.xsl contain a wrong version of translate-unit as well. <xsl:template name="translate-unit"> <!-- convert cell position expression unit, R1C1, R3, C4 --> <xsl:param name="column-number"/> <xsl:param name="row-number"/> <xsl:param name="column-pos-style"/> <xsl:param name="row-pos-style"/> <xsl:variable name="ColumnLetters"> <xsl:call-template name="ConvertColumnNumber"> <xsl:with-param name="ColumnNumber" select="$column-number"/> </xsl:call-template> </xsl:variable> <!-- position styles are 'absolute' or 'relative', --> <xsl:choose> <xsl:when test="$column-pos-style = 'absolute'"> <xsl:text>$</xsl:text> </xsl:when> </xsl:choose> <xsl:value-of select="$ColumnLetters"/> <xsl:choose> <xsl:when test="$row-pos-style ='absolute'"> <xsl:text>$</xsl:text> </xsl:when> </xsl:choose> <xsl:value-of select="$row-number"/> </xsl:template> <xsl:template name="ConvertColumnNumber"> <xsl:param name="ColumnNumber"/> <xsl:variable name="letters" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/> <xsl:choose> <xsl:when test="$ColumnNumber <= 26"> <xsl:value-of select="substring($letters, $ColumnNumber, 1)"/> </xsl:when> <xsl:otherwise> <xsl:call-template name="ConvertColumnNumber"> <xsl:with-param name="ColumnNumber" select="floor(($ColumnNumber - 1) div 26)"/> </xsl:call-template> <xsl:value-of select="substring($letters, ($ColumnNumber - 1) mod 26 + 1, 1)"/> </xsl:otherwise> </xsl:choose> </xsl:template>
Created attachment 87181 [details] ODS file created by opening the xml with with calc The attached ODS file shows the results of opening the XML file with Calc. From 677-702 are incorrect, then from 703-1024 are again correct.
Confirmed with the following configuration: Windows 10 Microsoft Windows Version 22H2 (OS Build19044-2604) Apache OpenOffice® 4.1.14 AOO4114m1(Build:9811)—Rev. a0d24fb625 2023-02-08 19:47 Columns 677-702 are incorrect, columns 703-1024 are again correct.