summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBartosz Kosiorek <gang65@poczta.onet.pl>2016-07-02 03:29:26 +0200
committerEike Rathke <erack@redhat.com>2016-12-05 17:40:33 +0000
commit91328bab6f47dc9659a2124a73d88ff3d7ba4279 (patch)
tree2a61d427b706205a444a33540cd8d5e8c4a4bfd2
parent7dd19273530730478b5ed24b79f42ac480c7ae43 (diff)
tdf#48767 Fix orientation issue after export to .xlsx
After save to .xlsx in usePrinterDefaults was added into PageSetup. Due to bug in MS Excel, when usePrinterDefaults is present, (no matter what value), the orientation of the Page is alway "portrait". To resolve that issue, if usePrinterDefaults is set to default value, then usePrinterDefaults XML field is not added during export to .xlsx Change-Id: I3ab310babb278913bce3d66f7fae1192ed9727b9 Reviewed-on: https://gerrit.libreoffice.org/26871 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com> (cherry picked from commit 46094ff4b0ea06931f2af3fc45d00fd38c3ebf26) Reviewed-on: https://gerrit.libreoffice.org/31641 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com>
-rw-r--r--sc/qa/unit/data/ods/hidden-empty-rows.odsbin7660 -> 8255 bytes
-rw-r--r--sc/qa/unit/subsequent_export-test.cxx17
2 files changed, 17 insertions, 0 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 5055dcb0d094..f9059eeb06e8 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();
@@ -194,6 +195,7 @@ public:
CPPUNIT_TEST(testCellNoteExportXLS);
CPPUNIT_TEST(testFormatExportODS);
CPPUNIT_TEST(testHiddenEmptyRowsXLSX);
+ CPPUNIT_TEST(testLandscapeOrientationXLSX);
CPPUNIT_TEST(testInlineArrayXLS);
CPPUNIT_TEST(testEmbeddedChartXLS);
CPPUNIT_TEST(testCellAnchoredGroupXLS);
@@ -488,6 +490,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);