This is an automated email from the ASF dual-hosted git repository.
damjan pushed a commit to branch AOO42X
in repository https://gitbox.apache.org/repos/asf/openoffice.git
The following commit(s) were added to refs/heads/AOO42X by this push:
new b9aa0698b1 In ODF (19.679.2 of ODF 1.3), the
<table:covered-table-cell> element's table:number-columns-repeated attribute
has a default value of 1, meaning the cell spans the cell to its right. However
when the XSLT import filter converts from SpreadsheetML's ss:MergeAcross to
ODF's table:number-columns-repeated, it always inserts a
<table:covered-table-cell> element, and then adds the
table:number-columns-repeated attribute only if it is greater than 1. This
breaks when ss:Merge [...]
b9aa0698b1 is described below
commit b9aa0698b102697d60533d02e6cbe50f52d1cb50
Author: Damjan Jovanovic <[email protected]>
AuthorDate: Thu Jan 12 03:02:18 2023 +0200
In ODF (19.679.2 of ODF 1.3), the <table:covered-table-cell> element's
table:number-columns-repeated attribute has a default value of 1,
meaning the cell spans the cell to its right. However when the XSLT import
filter converts from SpreadsheetML's ss:MergeAcross to ODF's
table:number-columns-repeated, it always inserts a
<table:covered-table-cell>
element, and then adds the table:number-columns-repeated attribute only if
it is greater than 1. This breaks when ss:MergeAcross="0", because ODF's
defaulting to 1 ends up occupying an extra empty cell to the right when it
shouldn't.
Fix this by only inserting the <table:covered-table-cell> when
ss:MergeAcross > 0.
Add a test document to prove this.
Fixes #100989 - SpreadsheetML: cell with ss:MergeAcross="0" gets an extra
empty cell to the right
Patch by: me
(cherry picked from commit a896732bfcd282115c06407a2f1da77694fa8d19)
---
.../import/spreadsheetml/spreadsheetml2ooo.xsl | 2 +-
.../Bug100989MergeAcross0AddsExtraEmptyCell.xml | 79 ++++++++++++++++++++++
.../source/fvt/uno/sc/formula/TestFormulaDocs.java | 1 +
3 files changed, 81 insertions(+), 1 deletion(-)
diff --git a/main/filter/source/xslt/import/spreadsheetml/spreadsheetml2ooo.xsl
b/main/filter/source/xslt/import/spreadsheetml/spreadsheetml2ooo.xsl
index 635278609e..a11a9a816c 100644
--- a/main/filter/source/xslt/import/spreadsheetml/spreadsheetml2ooo.xsl
+++ b/main/filter/source/xslt/import/spreadsheetml/spreadsheetml2ooo.xsl
@@ -6652,7 +6652,7 @@
</xsl:call-template>
</xsl:element>
<!-- ss:MergeAcross (column spanned)
indicates a covered table-cell in Open Document XML-->
- <xsl:if test="@ss:MergeAcross">
+ <xsl:if test="@ss:MergeAcross > 0">
<xsl:element
name="table:covered-table-cell">
<xsl:if
test="@ss:MergeAcross > 1">
<xsl:attribute
name="table:number-columns-repeated">
diff --git
a/test/testuno/data/uno/sc/fvt/Bug100989MergeAcross0AddsExtraEmptyCell.xml
b/test/testuno/data/uno/sc/fvt/Bug100989MergeAcross0AddsExtraEmptyCell.xml
new file mode 100644
index 0000000000..2149ce52c8
--- /dev/null
+++ b/test/testuno/data/uno/sc/fvt/Bug100989MergeAcross0AddsExtraEmptyCell.xml
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?mso-application progid="Excel.Sheet"?>
+<Workbook xmlns:c="urn:schemas-microsoft-com:office:component:spreadsheet"
xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:x2="http://schemas.microsoft.com/office/excel/2003/xml"
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:x="urn:schemas-microsoft-com:office:excel">
+ <OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">
+ <Colors>
+ <Color>
+ <Index>3</Index>
+ <RGB>#c0c0c0</RGB>
+ </Color>
+ <Color>
+ <Index>4</Index>
+ <RGB>#ff0000</RGB>
+ </Color>
+ </Colors>
+ </OfficeDocumentSettings>
+ <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
+ <WindowHeight>9000</WindowHeight>
+ <WindowWidth>13860</WindowWidth>
+ <WindowTopX>240</WindowTopX>
+ <WindowTopY>75</WindowTopY>
+ <ProtectStructure>False</ProtectStructure>
+ <ProtectWindows>False</ProtectWindows>
+ </ExcelWorkbook>
+ <Styles>
+ <Style ss:ID="Default" ss:Name="Default"/>
+ <Style ss:ID="Result" ss:Name="Result">
+ <Font ss:Bold="1" ss:Italic="1" ss:Underline="Single"/>
+ </Style>
+ <Style ss:ID="Result2" ss:Name="Result2">
+ <Font ss:Bold="1" ss:Italic="1" ss:Underline="Single"/>
+ <NumberFormat ss:Format="Currency"/>
+ </Style>
+ <Style ss:ID="Heading" ss:Name="Heading">
+ <Alignment ss:Horizontal="Center"/>
+ <Font ss:Bold="1" ss:Italic="1" ss:Size="16"/>
+ </Style>
+ <Style ss:ID="Heading1" ss:Name="Heading1">
+ <Alignment ss:Horizontal="Center" ss:Rotate="90"/>
+ <Font ss:Bold="1" ss:Italic="1" ss:Size="16"/>
+ </Style>
+ <Style ss:ID="co1"/>
+ <Style ss:ID="co2"/>
+ <Style ss:ID="co3"/>
+ <Style ss:ID="ta1"/>
+ <Style ss:ID="ce1"/>
+ </Styles>
+ <ss:Worksheet ss:Name="Sheet1">
+ <Table ss:StyleID="ta1">
+ <Column ss:Width="218.4408"/>
+ <Column ss:Width="89.9424"/>
+ <Column ss:Span="4" ss:Width="64.26"/>
+ <Row ss:Height="12.1032">
+ <Cell ss:StyleID="ce1">
+ <Data ss:Type="String">TestID</Data>
+ </Cell>
+ <Cell ss:StyleID="ce1">
+ <Data ss:Type="String">TestOK</Data>
+ </Cell>
+ <Cell ss:Index="7"/>
+ </Row>
+ <Row ss:Height="23.8392">
+ <Cell ss:StyleID="Default">
+ <Data ss:Type="String">A cell with ss:MergeAcross=”0”
+doesn't creates an empty column to the right</Data>
+ </Cell>
+ <Cell ss:StyleID="Default" ss:Formula="=R2C6="F2"">
+ <Data ss:Type="Boolean">0</Data>
+ </Cell>
+ <Cell ss:Index="5" ss:MergeAcross="0">
+ <Data ss:Type="String">E2 with ss:MergeAcross="0"</Data>
+ </Cell>
+ <Cell>
+ <Data ss:Type="String">F2</Data>
+ </Cell>
+ </Row>
+ </Table>
+ <x:WorksheetOptions/>
+ </ss:Worksheet>
+</Workbook>
diff --git a/test/testuno/source/fvt/uno/sc/formula/TestFormulaDocs.java
b/test/testuno/source/fvt/uno/sc/formula/TestFormulaDocs.java
index 89b9b02a17..56e2510900 100644
--- a/test/testuno/source/fvt/uno/sc/formula/TestFormulaDocs.java
+++ b/test/testuno/source/fvt/uno/sc/formula/TestFormulaDocs.java
@@ -75,6 +75,7 @@ public class TestFormulaDocs {
{"uno/sc/fvt/Basic Line as variable and Line
Input.ods", "Basic Line as variable and Line Input Test"},
{"uno/sc/fvt/comment-in-single-line-if-then-else.ods", "Basic comment after
single line if statement Test"},
{"uno/sc/fvt/Bug81233ColumnZReference.xml",
"Bug 81233 column Z reference wrongly converts to column A"},
+
{"uno/sc/fvt/Bug100989MergeAcross0AddsExtraEmptyCell.xml", "Bug 100989
ss:MergeCross=\"0\" adds an extra empty cell to the right"},
{"uno/sc/fvt/Bug128554FractionalSecondsIgnored.xml", "Bug 100989 fractional
seconds are silently ignored during import"}
});
}