summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/qa/unit/data/ods/hidden-empty-rows.odsbin7660 -> 8255 bytes
-rw-r--r--sc/qa/unit/subsequent_export-test.cxx17
-rw-r--r--sc/source/filter/excel/xepage.cxx5
3 files changed, 21 insertions, 1 deletions
diff --git a/sc/qa/unit/data/ods/hidden-empty-rows.ods b/sc/qa/unit/data/ods/hidden-empty-rows.ods
index f3435ad4304a..1e3017ef4306 100644
--- a/sc/qa/unit/data/ods/hidden-empty-rows.ods
+++ b/sc/qa/unit/data/ods/hidden-empty-rows.ods
Binary files differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 131069b6eca6..66ddef963753 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -111,6 +111,7 @@ public:
void testFormatExportODS();
void testHiddenEmptyRowsXLSX();
+ void testLandscapeOrientationXLSX();
void testInlineArrayXLS();
void testEmbeddedChartXLS();
@@ -195,6 +196,7 @@ public:
CPPUNIT_TEST(testCellNoteExportXLS);
CPPUNIT_TEST(testFormatExportODS);
CPPUNIT_TEST(testHiddenEmptyRowsXLSX);
+ CPPUNIT_TEST(testLandscapeOrientationXLSX);
CPPUNIT_TEST(testInlineArrayXLS);
CPPUNIT_TEST(testEmbeddedChartXLS);
CPPUNIT_TEST(testCellAnchoredGroupXLS);
@@ -490,6 +492,21 @@ void ScExportTest::testHiddenEmptyRowsXLSX()
assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[4]", "hidden", "false");
}
+void ScExportTest::testLandscapeOrientationXLSX()
+{
+ //tdf#48767 - Landscape page orientation is not loaded from .xlsx format with MS Excel, after export with Libre Office
+ ScDocShellRef xShell = loadDoc("hidden-empty-rows.", FORMAT_ODS);
+ CPPUNIT_ASSERT(xShell.Is());
+
+ std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
+ xmlDocPtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml");
+ CPPUNIT_ASSERT(pSheet);
+
+ // the usePrinterDefaults cannot be saved to allow opening sheets in Landscape mode via MS Excel
+ assertXPathNoAttribute(pSheet, "/x:worksheet/x:pageSetup", "usePrinterDefaults");
+ assertXPath(pSheet, "/x:worksheet/x:pageSetup", "orientation", "landscape");
+}
+
void ScExportTest::testDataBarExportXLSX()
{
ScDocShellRef xShell = loadDoc("databar.", FORMAT_XLSX);
diff --git a/sc/source/filter/excel/xepage.cxx b/sc/source/filter/excel/xepage.cxx
index 2895819d4ff9..31c17b6d251e 100644
--- a/sc/source/filter/excel/xepage.cxx
+++ b/sc/source/filter/excel/xepage.cxx
@@ -102,7 +102,10 @@ void XclExpSetup::SaveXml( XclExpXmlStream& rStrm )
pAttrList->add( XML_fitToHeight, OString::number( mrData.mnFitToHeight ).getStr() );
pAttrList->add( XML_pageOrder, mrData.mbPrintInRows ? "overThenDown" : "downThenOver" );
pAttrList->add( XML_orientation, mrData.mbPortrait ? "portrait" : "landscape" ); // OOXTODO: "default"?
- pAttrList->add( XML_usePrinterDefaults, XclXmlUtils::ToPsz( !mrData.mbValid ) );
+ // tdf#48767 if XML_usePrinterDefaults field is exist, then XML_orientation is always "portrait" in MS Excel
+ // To resolve that import issue, if XML_usePrinterDefaults has default value (false) then XML_usePrinterDefaults is not added.
+ if ( !mrData.mbValid )
+ pAttrList->add( XML_usePrinterDefaults, XclXmlUtils::ToPsz( !mrData.mbValid ) );
pAttrList->add( XML_blackAndWhite, XclXmlUtils::ToPsz( mrData.mbBlackWhite ) );
pAttrList->add( XML_draft, XclXmlUtils::ToPsz( mrData.mbDraftQuality ) );
pAttrList->add( XML_cellComments, mrData.mbPrintNotes ? "atEnd" : "none" ); // OOXTODO: "asDisplayed"?