summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/qa/unit/data/ods/autofilter-colbutton.odsbin0 -> 9626 bytes
-rw-r--r--sc/qa/unit/subsequent_export_test2.cxx13
-rw-r--r--sc/source/filter/excel/excrecds.cxx4
3 files changed, 15 insertions, 2 deletions
diff --git a/sc/qa/unit/data/ods/autofilter-colbutton.ods b/sc/qa/unit/data/ods/autofilter-colbutton.ods
new file mode 100644
index 000000000000..87d49ef2a4ec
--- /dev/null
+++ b/sc/qa/unit/data/ods/autofilter-colbutton.ods
Binary files differ
diff --git a/sc/qa/unit/subsequent_export_test2.cxx b/sc/qa/unit/subsequent_export_test2.cxx
index 81ad2857269c..f7a8e35c0907 100644
--- a/sc/qa/unit/subsequent_export_test2.cxx
+++ b/sc/qa/unit/subsequent_export_test2.cxx
@@ -543,6 +543,19 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testAutofilterTop10XLSX)
assertXPath(pDoc, "//x:autoFilter/x:filterColumn/x:top10"_ostr, "val"_ostr, u"4"_ustr);
}
+CPPUNIT_TEST_FIXTURE(ScExportTest2, testAutofilterColButton)
+{
+ // Without fix it will fail
+ // - Expression: !xmlGetProp(pXmlNode, BAD_CAST(rAttribute.getStr()))
+ // - In <>, XPath '//x:autoFilter/x:filterColumn' unexpected 'hiddenButton' attribute
+ createScDoc("ods/autofilter-colbutton.ods");
+
+ save(u"Calc Office Open XML"_ustr);
+ xmlDocUniquePtr pDoc = parseExport(u"xl/worksheets/sheet1.xml"_ustr);
+ CPPUNIT_ASSERT(pDoc);
+ assertXPathNoAttribute(pDoc, "//x:autoFilter/x:filterColumn"_ostr, "hiddenButton"_ostr);
+}
+
CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf88657ODS)
{
createScDoc("ods/tdf88657.ods");
diff --git a/sc/source/filter/excel/excrecds.cxx b/sc/source/filter/excel/excrecds.cxx
index 381836c10c12..4e7301e3dece 100644
--- a/sc/source/filter/excel/excrecds.cxx
+++ b/sc/source/filter/excel/excrecds.cxx
@@ -993,10 +993,10 @@ ExcAutoFilterRecs::ExcAutoFilterRecs( const XclExpRoot& rRoot, SCTAB nTab, const
bContLoop = rEntry.bDoQuery;
if( bContLoop )
{
- SCCOL nCol = static_cast<SCCOL>( rEntry.nField ) - aRange.aStart.Col();
+ SCCOL nCol = static_cast<SCCOL>(rEntry.nField);
+ XclExpAutofilter* pFilter = GetByCol( nCol - aRange.aStart.Col() );
auto nFlag = rDoc.GetAttr( nCol, nRow, nTab, ATTR_MERGE_FLAG )->GetValue();
bool bIsButtonHidden = !( nFlag & ScMF::Auto );
- XclExpAutofilter* pFilter = GetByCol( nCol );
pFilter->SetButtonHidden( bIsButtonHidden );
if( nEntry > 0 )