Issue 124843 - Wrong page orientation when Writer opens docx with different orientation pages
Summary: Wrong page orientation when Writer opens docx with different orientation pages
Status: UNCONFIRMED
Alias: None
Product: Writer
Classification: Application
Component: open-import (show other issues)
Version: 3.4.0
Hardware: All All
: P3 Normal (vote)
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords: needmoreinfo
Depends on:
Blocks:
 
Reported: 2014-05-07 07:47 UTC by Alex_savelyev
Modified: 2016-11-26 19:27 UTC (History)
5 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
a sample document (17.22 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2014-05-20 19:51 UTC, Alex_savelyev
no flags Details
This file is displayed correctly (9.87 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2016-10-22 19:29 UTC, Niklas Holmström
no flags Details
Second page remain in landscape, but table stretch to wide. (10.19 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2016-10-22 19:30 UTC, Niklas Holmström
no flags Details
Second page orientation shifted to portrait (1) (10.18 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2016-10-22 19:31 UTC, Niklas Holmström
no flags Details
Second page orientation shifted to portrait (2) (10.24 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2016-10-22 19:31 UTC, Niklas Holmström
no flags Details
Second page orientation shifted to portrait (3) (10.27 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2016-10-22 19:32 UTC, Niklas Holmström
no flags Details
First page have disappeared and second page has changed rotation. (10.17 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2016-10-22 19:33 UTC, Niklas Holmström
no flags Details
Figure 1 (735.18 KB, image/png)
2016-11-26 19:25 UTC, Ogbonnaya Ngwu
no flags Details
Fgure 2 (474.31 KB, image/png)
2016-11-26 19:26 UTC, Ogbonnaya Ngwu
no flags Details
Figure 3 (674.32 KB, image/png)
2016-11-26 19:26 UTC, Ogbonnaya Ngwu
no flags Details
Figure 4 (655.89 KB, image/png)
2016-11-26 19:26 UTC, Ogbonnaya Ngwu
no flags Details
Figure 5 (334.72 KB, image/png)
2016-11-26 19:27 UTC, Ogbonnaya Ngwu
no flags Details
Figure 6 (312.01 KB, image/png)
2016-11-26 19:27 UTC, Ogbonnaya Ngwu
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description Alex_savelyev 2014-05-07 07:47:05 UTC
File has first page as portrait and second page as landscape.

Writer opens both pages in portrait
Comment 1 Rainer Bielefeld 2014-05-19 18:08:20 UTC
@Alex_savelyev:
Please attach a sample document
Comment 2 Alex_savelyev 2014-05-20 19:51:56 UTC
Created attachment 83438 [details]
a sample document
Comment 3 rushil2011 2014-09-22 23:30:29 UTC
I tried to replicate this bug in openoffice writer version 3.4.0, on windows 8 and Ubuntu 14.04LTS operating systems. Initially, I was unable to replicate this bug during my testing. Below are the steps I took for replicating this bug.
1.	Open writer
2.	Create a new document in .doc format
3.	Type “Test Page 1” on page 1
4.	Click Insert, and select “Manual break”
5.	In the pop up window, under “style”, select “landscape” and click OK. 
6.	This created a new page in landscape orientation. 
7.	On the new page, type “Test Page 2”
8.	Save the document and exit the software. 
9.	Reopen the application by double clicking on the document from the directory.

When the document loaded, the page orientations were correct; the first page was in portrait mode and the second page was in the landscape mode. I confirmed this results with .odt files as well.

After this unsuccessful attempt, I downloaded the sample file that is attached to this bug report. When I opened that sample file, I saw that both pages were in portrait mode confirming the bug. I also confirmed the bug by opening the same file in Microsoft office 2010 and noticing that Page 1 was in portrait orientation and Page 2 was in landscape orientation. 

After spending a little more time troubleshooting, I noticed that the file that is attached to this bug report is in .docx format. So I tried replicating the behavior by creating a new .docx document with writer. However, I found out that version 3.4.0 of writer does not allow you create a .docx file, so I thought that this version of open office may not support .docx files. 

To confirm this, I read the feature release notes and discovered that openoffice version 3.0 and above supports importing of office 2007 files, which means that .docx files are supported by the 3.4.0 version of writer, which makes this behavior a bug.

I tested this on the latest version of openoffice (version 4.1.1) and was unable to replicate the behavior. Hence, this bug may have been fixed in the later versions of writer.

This bug can be replicated on version 3.4.0 of writer by taking following steps:
1.	Create a new document in .docx format using a later version of writer or using office 2007 or above.
2.	Type random text on page 1
3.	Insert new page in landscape mode
4.	Type random text on page 2.
5.	Save the document in .docx file format and close the application
6.	Open the saved file in writer version 3.4.0
7.	Notice the orientation of Page 2 is changes to portrait from landscape.
8.	Opening same file in a newer version of writer (Ex. 4.1), you’ll noticed that the orientation remains unchanged.
Comment 4 rushil2011 2014-09-23 23:08:31 UTC
Corrections in my previous comment:

The bug is not fixed in the version 4.1.1 of openoffice. Instead of opening the file that is attached to this bug report in openoffice writer, I accidentally opened it in libreoffice writer.


I tested the file on the latest version of openoffice(4.1.1) and was able to see the failure. However the failure was different than the one described here. When I opened the docx file in writer, the writer only displayed the first page of the file. It didn't display the second page that was in the landscape orientation or its contents.


Below are correct steps to replicate this bug in writer:

1.	Create a new document in .docx format using libreoffice or using Microsoft office 2007 or above.
2.	Type "Test Page 1" on page 1
3.	Insert new page in landscape mode
4.	Type "Test Page 2" on page 2.
5.	Save the document in .docx file format and close the application
6.	Open the saved file in openoffice writer
7.	Notice that writer only displays the contents of first page and it won't display the contents of the second page.
Comment 5 Bernard Guiang 2016-10-01 02:02:45 UTC
I tested this bug using Apache OpenOffice 4.1.2 on Windows 8.1 and got a different result. Opening the sample document given on Microsoft Word 2016 displays the first page as portrait and the second page as landscape with a table object on it. After opening the same document in OpenOffice, the document appears to only have just one page in portrait with the table object in the first and only page.

I wasn't sure how the given document was created so I tried creating my own document. I was able to make a .docx file in Microsoft Office 2016 with different page orientations that showed up correctly in OpenOffice 4.1.2 with the following steps:
1.) Open up Word and create a new blank document
2.) Create a section break via Layout -> breaks -> Next Page (under Section Breaks)
3.) Click on the new page created to place the cursor the second page
4.) Change the orientation of the page via Layout -> Orientation -> Landscape
5.) Create another page by repeating step 2
6.) Click on the new third page
7.) Change the orientation of the page via Layout -> Orientation -> Portrait
8.) Save the document (as .docx)
Comment 6 Niklas Holmström 2016-10-22 19:28:07 UTC
Environment:
Windows 10 64-bit Home edition (version 10.0.14393).
Microsoft Office Word 2007 version 12.0.6758.5000
AOO412m3(Build:9782)  -  Rev. 1709696

Hi!

I was able to reproduce this problem on AOO 4.1.2. I noticed that the sample file document attached contains a table on page two. And as far as I can see this is a trigger for this problem. If a table is inserted at the very beginning of the second page (the one in landscape), you will get this problem. 

Step-by-step:
1. Open Microsoft Office Word (I used Word 2007)
2. Create a new empty document.
3. Add some text (or not) to the first page, this page should be in portrait.
4. Add a new page to the document, that is in landscape.
5. Add a basic table in the first line of the page.(Number of columns and rows doesn't appear to matter.)
6. Save the document as a .docx file.
7. Open it in AOO writer, and compare the output.

Problem:
There are actually several problems here, depending on if the first page was left empty or not.

1. When the first page contains text, and the second page contains a table (like in Test3.docx, Test4.docx and Test5.docx):
- The second page is displayed in portrait, and the table will stretch outside the document.

2. When the first page is empty, and the second page contains a table (like in Test6.docx):
- The first page is missing, and the second page is rotated to portrait. And the table will stretch outside the document.

3. When the first page contain text, and the second page contain first text then a table (like Test2.docx):
- The second page will remain in landscape, but the table will stretch slightly outside the boarders of the document.

Additional information:
I've attached 6 different .docx test files, all created and displayed properly in Microsoft Office 2007. In these files it's only the Test1.docx that seems to be displayed properly, all other files suffer from some of the problems mentioned above.
Comment 7 Niklas Holmström 2016-10-22 19:29:31 UTC
Created attachment 85750 [details]
This file is displayed correctly
Comment 8 Niklas Holmström 2016-10-22 19:30:26 UTC
Created attachment 85751 [details]
Second page remain in landscape, but table stretch to wide.
Comment 9 Niklas Holmström 2016-10-22 19:31:34 UTC
Created attachment 85752 [details]
Second page orientation shifted to portrait (1)
Comment 10 Niklas Holmström 2016-10-22 19:31:52 UTC
Created attachment 85753 [details]
Second page orientation shifted to portrait (2)
Comment 11 Niklas Holmström 2016-10-22 19:32:17 UTC
Created attachment 85754 [details]
Second page orientation shifted to portrait (3)
Comment 12 Niklas Holmström 2016-10-22 19:33:08 UTC
Created attachment 85755 [details]
First page have disappeared and second page has changed rotation.
Comment 13 Ogbonnaya Ngwu 2016-11-26 19:23:00 UTC
I was able to replicate this bug using Microsoft Office Word 2016, LibreOffice Writer 5.0.6.2,OpenOffice 4.2.0, and detailed replication steps provided by Holstrom on the Apache Bugzilla database. After successful replication, I varied the testing conditions to observe the impact of the bug. The bug had a high impact on documents created using Microsoft Word, most notably the loss
of data. The files used for the test has the first and last page in portrait and landscape orientation respectively. When the content of file is only typed on the second page and the first page left blank, the data was lost when the file was opened in OpenOffice Writer. This is a huge impact to users who dread the loss of information. This loss of data indicates the seriousness of
the bug. Figures 1 and 2 shows the test document in MS Word and OO Writer respectively.

Also, it is important to note that only one of the pages is shown in OO Writer in Landscape layout instead of portrait and the typed data is lost. Figures 3 and 4 shows the test document when we have content in both first and second page. In this case, the bug was not replicated successfully (maybe it has been fixed). As shown in the figures below, OO Writer maintains the appropriate layout of the document. A fatal error only occurs when there is no text content on the first page.

For documents created with LibreOffice Writer, regardless of whether text content was placed in first page, second page, both or none, OO Writer maintains the appropriate format of the page layout in portrait and landscape. However, it also leads to a very fatal design error. Files used in this test were created using the same techniques for the MS Word documents. When the test document is opened in OO Writer, it losses the ability to optimally arrange pages to maximize space usage during zoom in and zoom out. OO Writer treats the page structure as if it was a picture. Consider figure 4, when we zoomed out in order to see the two pages side-byside instead of the usual linear arrangement, OO Writer efficiently places the pages side-by-side once there is enough space to contain both. In the case of files created with LibreOffice, OO Writer retains the linear arrangement and only makes it smaller. This problem is illustrated by figures 5 and 6 below.
Comment 14 Ogbonnaya Ngwu 2016-11-26 19:25:36 UTC
Created attachment 85865 [details]
Figure 1
Comment 15 Ogbonnaya Ngwu 2016-11-26 19:26:00 UTC
Created attachment 85866 [details]
Fgure 2
Comment 16 Ogbonnaya Ngwu 2016-11-26 19:26:20 UTC
Created attachment 85867 [details]
Figure 3
Comment 17 Ogbonnaya Ngwu 2016-11-26 19:26:46 UTC
Created attachment 85868 [details]
Figure 4
Comment 18 Ogbonnaya Ngwu 2016-11-26 19:27:06 UTC
Created attachment 85869 [details]
Figure 5
Comment 19 Ogbonnaya Ngwu 2016-11-26 19:27:32 UTC
Created attachment 85870 [details]
Figure 6