[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/qa sc/source
Samuel Mehrbrodt (via logerrit)
logerrit at kemper.freedesktop.org
Mon Sep 27 11:04:22 UTC 2021
sc/qa/unit/subsequent_export-test2.cxx | 2 -
sc/source/filter/excel/excrecds.cxx | 1
sc/source/filter/excel/xestyle.cxx | 42 +++++++++++++++++----------------
3 files changed, 24 insertions(+), 21 deletions(-)
New commits:
commit 9c2bf889bdd8d83b58996b8fdc6727fec75cdcd3
Author: Samuel Mehrbrodt <samuel.mehrbrodt at allotropia.de>
AuthorDate: Fri Sep 24 15:13:44 2021 +0200
Commit: Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Mon Sep 27 13:03:47 2021 +0200
tdf#76258 Fix xlsx export of color filter colors
Change-Id: I08bd46fe10a8fc35a9c2a87745ee3e8cb4c676d5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116648
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt at allotropia.de>
(cherry picked from commit d148ed642f2aef2c2cc8615296cc648249a4878d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122603
Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
diff --git a/sc/qa/unit/subsequent_export-test2.cxx b/sc/qa/unit/subsequent_export-test2.cxx
index 77e4bc37673e..dde758e2bd5b 100644
--- a/sc/qa/unit/subsequent_export-test2.cxx
+++ b/sc/qa/unit/subsequent_export-test2.cxx
@@ -734,7 +734,7 @@ void ScExportTest2::testAutofilterColorsOOXML()
"xl/tables/table1.xml", FORMAT_XLSX);
CPPUNIT_ASSERT(pDoc);
- assertXPath(pDoc, "/x:table/x:autoFilter/x:filterColumn/x:colorFilter", "dxfId", "4");
+ assertXPath(pDoc, "/x:table/x:autoFilter/x:filterColumn/x:colorFilter", "dxfId", "5");
}
void ScExportTest2::testAutofilterColorsStyleOOXML()
diff --git a/sc/source/filter/excel/excrecds.cxx b/sc/source/filter/excel/excrecds.cxx
index 8ce820bb2389..e0aec39a5173 100644
--- a/sc/source/filter/excel/excrecds.cxx
+++ b/sc/source/filter/excel/excrecds.cxx
@@ -854,6 +854,7 @@ void XclExpAutofilter::SaveXml( XclExpXmlStream& rStrm )
nDxfId = GetDxfs().GetDxfByBackColor(color);
else
nDxfId = GetDxfs().GetDxfByForeColor(color);
+ nDxfId++; // Count is 1-based
rWorksheet->singleElement(XML_colorFilter, XML_dxfId, OString::number(nDxfId));
}
}
diff --git a/sc/source/filter/excel/xestyle.cxx b/sc/source/filter/excel/xestyle.cxx
index df4afbaf5eca..8abd140e2b9f 100644
--- a/sc/source/filter/excel/xestyle.cxx
+++ b/sc/source/filter/excel/xestyle.cxx
@@ -3053,8 +3053,7 @@ XclExpDxfs::XclExpDxfs( const XclExpRoot& rRoot )
xFormatter->FillKeywordTableForExcel( *mpKeywordTable );
SCTAB nTables = rRoot.GetDoc().GetTableCount();
- sal_Int32 nForeColorIndex = 0;
- sal_Int32 nBackColorIndex = 0;
+ sal_Int32 nColorIndex = 0;
sal_Int32 nCondFormattingIndex = 0;
for(SCTAB nTab = 0; nTab < nTables; ++nTab)
{
@@ -3064,27 +3063,30 @@ XclExpDxfs::XclExpDxfs( const XclExpRoot& rRoot )
{
ScRange aRange;
pData->GetArea(aRange);
- ScFilterEntries aFilterEntries;
- rRoot.GetDoc().GetFilterEntriesArea(aRange.aStart.Col(), aRange.aStart.Row(),
- aRange.aEnd.Row(), nTab, true, aFilterEntries);
-
- for (auto& rColor : aFilterEntries.getBackgroundColors())
+ for (auto nCol = aRange.aStart.Col(); nCol <= aRange.aEnd.Col(); nCol++)
{
- if (!maBackColorToDxfId.emplace(rColor, nBackColorIndex).second)
- continue;
+ ScFilterEntries aFilterEntries;
+ rRoot.GetDoc().GetFilterEntriesArea(nCol, aRange.aStart.Row(),
+ aRange.aEnd.Row(), nTab, true, aFilterEntries);
- std::unique_ptr<XclExpCellArea> pExpCellArea(new XclExpCellArea(0, rColor));
- maDxf.push_back(std::make_unique<XclExpDxf>(rRoot, std::move(pExpCellArea)));
- nBackColorIndex++;
- }
- for (auto& rColor : aFilterEntries.getTextColors())
- {
- if (!maForeColorToDxfId.emplace(rColor, nForeColorIndex).second)
- continue;
+ for (auto& rColor : aFilterEntries.getBackgroundColors())
+ {
+ if (!maBackColorToDxfId.emplace(rColor, nColorIndex).second)
+ continue;
- std::unique_ptr<XclExpCellArea> pExpCellArea(new XclExpCellArea(rColor, 0));
- maDxf.push_back(std::make_unique<XclExpDxf>(rRoot, std::move(pExpCellArea)));
- nForeColorIndex++;
+ std::unique_ptr<XclExpCellArea> pExpCellArea(new XclExpCellArea(0, rColor));
+ maDxf.push_back(std::make_unique<XclExpDxf>(rRoot, std::move(pExpCellArea)));
+ nColorIndex++;
+ }
+ for (auto& rColor : aFilterEntries.getTextColors())
+ {
+ if (!maForeColorToDxfId.emplace(rColor, nColorIndex).second)
+ continue;
+
+ std::unique_ptr<XclExpCellArea> pExpCellArea(new XclExpCellArea(rColor, 0));
+ maDxf.push_back(std::make_unique<XclExpDxf>(rRoot, std::move(pExpCellArea)));
+ nColorIndex++;
+ }
}
}
More information about the Libreoffice-commits
mailing list