Bug 48767 - Landscape page orientation is not loaded from .xlsx format with MS Excel, after export with Libre Office
Summary: Landscape page orientation is not loaded from .xlsx format with MS Excel, aft...
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
3.3.0 release
Hardware: Other All
: medium normal
Assignee: Bartosz
URL:
Whiteboard: target:5.3.0 target:5.2.2 target:5.2.5
Keywords:
: 49084 78046 (view as bug list)
Depends on:
Blocks: XLSX-Sheet
  Show dependency treegraph
 
Reported: 2012-04-16 05:11 UTC by Yogurt
Modified: 2017-09-29 12:30 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
Landscape A4 page saved by LibO Calc (6.32 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2012-04-16 05:11 UTC, Yogurt
Details
Landscape A4 page saved by MS Excel (8.99 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2012-04-16 05:11 UTC, Yogurt
Details
xlsx file saved by LO 4.1.4.2. (4.53 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2013-12-27 09:52 UTC, Kevin Suo
Details
xlsx file saved by MSO 2010 (8.71 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2013-12-27 09:54 UTC, Kevin Suo
Details
Excel 2007 Worksheet (XLSX) saved by LO Calc 4.4.2 on Windows XP (7.74 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2015-04-19 18:32 UTC, Tom Williams
Details
Screen shot of Excel worksheet in LO Calc 4.4.2 on Windows XP (77.09 KB, image/png)
2015-04-19 18:33 UTC, Tom Williams
Details
Screen shot of Excel worksheet in Excel 2007 on Windows XP (53.87 KB, image/png)
2015-04-19 18:35 UTC, Tom Williams
Details
Here is the landscape-saved-by-lo-4_1_4.xlsx which was not opening in Excel 2010 correctly, which was resaved by Fixed LO (4.74 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2016-07-03 19:18 UTC, Bartosz
Details
Here is the landscape-saved-by-mso-2010.xlsx which was not opening in Excel 2010 correctly, which was resaved by Fixed LO (5.21 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2016-07-03 19:19 UTC, Bartosz
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Yogurt 2012-04-16 05:11:09 UTC
Created attachment 60059 [details]
Landscape A4 page saved by LibO Calc

Steps to reproduce:
1. Create new spreadsheet.
2. Go to Format / Page... / Page.
3. Set Landscape page orientation (or exchange dimensions so that width is greater than height).
4. Write anything into the bottom-right cell of the page, marked by the dashed lines.
5. Save in Office Open XML (.xlsx) format.
6. Load the saved file either in LibO or MS Excel.

Expected:
Conserving landscape page orientation.

What happens:
Page is reverted to portrait.

Note #1: The same thing works perfectly with LibO Writer and the .docx file format. So this is a Calc-only bug.

Note #2: This bug may be connected to Bug 40146.
Comment 1 Yogurt 2012-04-16 05:11:39 UTC
Created attachment 60060 [details]
Landscape A4 page saved by MS Excel
Comment 2 Markus Mohrhard 2012-04-23 14:41:32 UTC
*** Bug 49084 has been marked as a duplicate of this bug. ***
Comment 3 OfficeUser 2012-04-24 12:09:40 UTC
I have adjusted the summary since trying to import an landscape formatted xlsx produced by Excel revealed that LibO's import filter also fails to handle landscape format in xlsx.
Comment 4 Tom Williams 2013-05-06 22:02:11 UTC
I've just encountered this using LibreOffice 4.0.3.2 (rc2) on Ubuntu 13.04 Linux (64-bit).  When I load a spreadsheet with a landscape page orientation that I created in LibreOffice and saved in Excel 2007/2010 format in LibreOffice, the landscape page orientation is preserved.  When I open that same document in Excel 2007 on Windows XP, the page orientation is portrait.
Comment 5 Kevin Suo 2013-12-27 09:26:37 UTC
Tested in LibreOffice 4.1.4.2 and 4.2.0.1:

1. New spreadsheet, input something;
2. Set page to landscape;
2. Save as ms-office-2007/2010 (.xlsx);
3. Load in LibreOffice, page is Landscape;
4. Load in MSO 2010, page is Portrait

So:
LO knows the page is Landscape,
but MSO dont know it.

Further testing:
5. Set the page as Landscape in MSO, save.
6. Open in LibreOffice, page is Landscape.
7. Do some editing, save, and load in MSO, page is Portrait again.

So, LO exported the wrong page orientation info in xlsx.
Comment 6 Kevin Suo 2013-12-27 09:49:46 UTC
(In reply to comment #5)
> Tested in LibreOffice 4.1.4.2 and 4.2.0.1:

> 2. Save as ms-office-2007/2010 (.xlsx);

unzip the xlsx file saved by LibreOffice, I found the following in /xl/worksheets/sheet1.xml:
<pageSetup blackAndWhite="false" cellComments="none" copies="1" draft="false" firstPageNumber="1" fitToHeight="1" fitToWidth="1" horizontalDpi="300" orientation="landscape" pageOrder="downThenOver" paperSize="9" scale="100" useFirstPageNumber="true" usePrinterDefaults="false" verticalDpi="300"/>

> Further testing:
> 5. Set the page as Landscape in MSO, save.

unzip the xlsx file save by MSO, I found the following in /xl/worksheets/sheet1.xml:
<pageSetup paperSize="9" orientation="landscape" useFirstPageNumber="1" horizontalDpi="300" verticalDpi="300" r:id="rId1"/>

They are all orientation="landscape", except that xlsx save by LO is much "bigger" (have more xml attributes).
So why is it portrait when load in MSO? A MSO bug?
Comment 7 Kevin Suo 2013-12-27 09:52:45 UTC
Created attachment 91212 [details]
xlsx file saved by LO 4.1.4.2.

 the page should be landscape, but appears portrait when loaded in MSO 2010.
Comment 8 Kevin Suo 2013-12-27 09:54:20 UTC
Created attachment 91213 [details]
xlsx file saved by MSO 2010

the page is landscape when loaded in LO or MSO.
But when edited by LO and save, it's portrait again when loaded in MSO.
Comment 9 QA Administrators 2015-04-19 03:23:36 UTC Comment hidden (obsolete)
Comment 10 OfficeUser 2015-04-19 09:35:53 UTC
Can confirm fixed in

Version: 4.4.1.2
Build-ID: 45e2de17089c24a1fa810c8f975a7171ba4cd432
Gebietsschema: de_DE

(Tested Linux build.)
Comment 11 Tom Williams 2015-04-19 18:29:36 UTC
This problem still occurs to me using LO Calc 4.4.2 on Windows XP.  When I open an Excel 2007 worksheet in LO Calc, it shows the page orientation as landscape. I can save the file in XLSX format ok and when I open it in Excel 2007, the page orientation is portrait.

I'll attach my XLSX file and some screen shots.
Comment 12 Tom Williams 2015-04-19 18:32:08 UTC
Created attachment 114918 [details]
Excel 2007 Worksheet (XLSX) saved by LO Calc 4.4.2 on Windows XP

This is the actual Excel worksheet I saved in LO Calc 4.4.2 on Windows XP.
Comment 13 Tom Williams 2015-04-19 18:33:58 UTC
Created attachment 114919 [details]
Screen shot of Excel worksheet in LO Calc 4.4.2 on Windows XP

This is a screen shot of the page orientation shown in LO Calc 4.4.2 on Windows XP of the "tom-test.xlsx" file.
Comment 14 Tom Williams 2015-04-19 18:35:24 UTC
Created attachment 114921 [details]
Screen shot of Excel worksheet in Excel 2007 on Windows XP

This is a screen shot of the "tom-test.xlsx" file as shown in Excel 2007 on Windows XP.  This is after I saved a change using LO Calc 4.4.2, on the same system.  Notice Excel shows the page orientation as portrait, not landscape.
Comment 15 Bartosz 2016-07-02 07:21:33 UTC
I have found solution, and created review:
https://gerrit.libreoffice.org/#/c/26871/

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
Comment 16 Bartosz 2016-07-03 19:18:37 UTC
Created attachment 126044 [details]
Here is the landscape-saved-by-lo-4_1_4.xlsx which was not opening in Excel 2010 correctly, which was resaved by Fixed LO
Comment 17 Bartosz 2016-07-03 19:19:40 UTC
Created attachment 126045 [details]
Here is the landscape-saved-by-mso-2010.xlsx which was not opening in Excel 2010 correctly, which was resaved by Fixed LO
Comment 18 Commit Notification 2016-07-03 23:59:12 UTC
Bartosz Kosiorek committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=46094ff4b0ea06931f2af3fc45d00fd38c3ebf26

tdf#48767 Fix orientation issue after export to .xlsx

It will be available in 5.3.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 19 Kevin Suo 2016-07-29 02:04:06 UTC
I request this fix be backported to 5.2 version, as this is an important issue which causes formatting loss.
Comment 20 Bartosz 2016-07-31 21:48:49 UTC
*** Bug 78046 has been marked as a duplicate of this bug. ***
Comment 21 Bartosz 2016-08-12 12:31:36 UTC
Review for lo-5-2:
https://gerrit.libreoffice.org/#/c/28084/
Comment 22 Commit Notification 2016-08-18 10:04:47 UTC
Bartosz Kosiorek committed a patch related to this issue.
It has been pushed to "libreoffice-5-2":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=dd99a9fd72f73c9d7c1b9ac6754f3d17568af81b&h=libreoffice-5-2

tdf#48767 Fix orientation issue after export to .xlsx (lo-5-2)

It will be available in 5.2.2.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 23 Kevin Suo 2016-08-18 13:02:38 UTC
Thank you so much for the perfect fix.
Comment 24 Commit Notification 2016-12-05 17:43:49 UTC
Bartosz Kosiorek committed a patch related to this issue.
It has been pushed to "libreoffice-5-2":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=91328bab6f47dc9659a2124a73d88ff3d7ba4279&h=libreoffice-5-2

tdf#48767 Fix orientation issue after export to .xlsx

It will be available in 5.2.5.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.