Bug 42144 - FILESAVE as .doc (MSO97) looses page bottom margin formatting
Summary: FILESAVE as .doc (MSO97) looses page bottom margin formatting
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
3.4.3 release
Hardware: x86-64 (AMD64) Windows (All)
: medium major
Assignee: Miklos Vajna
URL:
Whiteboard: target:4.1.0 target:4.0.4
Keywords:
Depends on:
Blocks: mab3.6
  Show dependency treegraph
 
Reported: 2011-10-23 22:08 UTC by Lee Cramer
Modified: 2013-05-06 14:58 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
One of the files formatted as described above. (18.00 KB, application/msword)
2011-10-23 22:08 UTC, Lee Cramer
Details
Sample Document (24.99 KB, application/vnd.oasis.opendocument.text)
2012-08-14 06:00 UTC, Rainer Bielefeld Retired
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lee Cramer 2011-10-23 22:08:00 UTC
Created attachment 52669 [details]
One of the files formatted as described above.

I am formatting .doc files to be read on an eBook reader:  portrait, 3.50 x 4.70 inches, 0.02 margins, header on, footer off.  When I save and reopen, the bottom margin is set to 0.50 and the footer is turned on.
Comment 1 Lee Cramer 2011-10-23 22:14:21 UTC
This problem is related to turning the header on.  When the header is off, margins and footer are not reset.
Comment 2 Florian Reisinger 2012-02-25 09:51:15 UTC
I can confirm that issue LibO 3,5 Win7x64
Bottom margain : 1,27cm ~0,5 inch
Rest: 0,05 cm ~0,02 inch
Comment 3 Cor Nouws 2012-04-18 11:57:21 UTC
(In reply to comment #0)
> Created attachment 52669 [details]
> One of the files formatted as described above.

Do you create the files in Word on in Writer?
In word: do you use sections?
If in Writer: do you use page styles?

thanks!

Cor
Comment 4 Rainer Bielefeld Retired 2012-08-14 05:58:28 UTC
It seems to be a FILESAVE problem.

My test with "LibreOffice  3.5.6.2  German UI/Locale [Build-ID: e0fbe70-5879838-a0745b0-0cd1158-638b327] on German WIN7 Home Premium (64bit):

1. opened reporters sample
2. measure unit to inches
3. Menu 'Format -> Page': footer off, Bottom Margin 0,5" -> 0,02" 
   (ignore Printer Warning), <ok>
   > Result: text until end of sheet, for example 
     " ... manner similar to cutting canned tomatoes."
     for me on page 2 directly at page bottom
4. Save as "Mozzarella Cheese356.doc" and close
5. Reopen with MS WORD viewer
   Expected: on all pages text more or less until bottom pf paper sheet
   Actual: app. 3 text line height blank margin at page bottom

Reproducible with an own document, please see attached simple "Mysample.odt":

10. Download sample, start LibO
11. Open "Mysample.odt" from LibO Start Center file dialog
    > You see that the lorem ipsum text reaches page bottom
12. Menu 'File -> Save as -> "MysampleLibO.doc (MS WORD 97)
13. Close document
14. Reopen:
    Expected:  lorem ipsum text reaches page bottom
    Actual: Approximately 4 text lines high margin at bottom (visible with LibO,
            MS WORD Viewer"

Might be inherited from Latest OOo version, because also reproducible with 
AOOo 3.4.

Still [Reproducible] with parallel installation of Master "LOdev  3.7.0.0.alpha0+   - WIN7 Home Premium (64bit) ENGLISH UI [Build ID: 7d8cd0a]" (tinderbox: 2008R2@20, pull time 2012-08-10 23:27:17), at least with this version no problem with save as OOXML

Might be that MS WORD only allows pages with footer if header is active but
- I do not believe so
- Problem did not exist with OOo 3.1.1

@Cédric:
Please set Status to ASSIGNED and add yourself to "Assigned To" if you accept this Bug or forward the Bug if it's not your turf.
Comment 5 Rainer Bielefeld Retired 2012-08-14 06:00:01 UTC
Created attachment 65529 [details]
Sample Document

See comment before how to use sample!
Comment 6 Michael Meeks 2012-12-07 15:02:00 UTC
Problem persists with LibreOffice 4.0 beta1.
Interestingly we can save the document as .docx and re-load it without loosing that state - and in theory the vast majority of that code is shared.

So potentially - when found, it should be reasonably fix-able.
Comment 7 Michael Meeks 2012-12-07 20:37:38 UTC
A comparison of the generated OOXML for both the .doc and the .docx suggests that this is the underlying cause:

+    <w:sectPr w:rsidR="001E44D8" w:rsidSect="001E44D8">
       <w:headerReference w:type="default" r:id="rId6"/>
-      <w:footerReference w:type="even" r:id="rId7"/>
-      <w:footerReference w:type="default" r:id="rId8"/>
-      <w:headerReference w:type="first" r:id="rId9"/>
-      <w:footerReference w:type="first" r:id="rId10"/>
       <w:pgSz w:w="7937" w:h="11509"/>
-      <w:pgMar w:top="605" w:right="29" w:bottom="29" w:left="29" w:header="29" w:footer="720" w:gutter="0"/>
+      <w:pgMar w:top="605" w:right="29" w:bottom="29" w:left="29" w:header="29" w:footer="0" w:gutter="0"/>
       <w:cols w:space="720"/>
+      <w:formProt w:val="0"/>
     </w:sectPr>

in particular the w:footer="720" that looks erroneous to me from the .doc.
Comment 8 Joel Madero 2013-02-12 17:09:39 UTC
As this is a relatively general problem that has the potential to affect quite a few users, has reproducible steps from Rainer for a new document and has been confirmed by Michael to still exist on LibreOffice 4, I am moving this to 3.6 MAB. 

3.5 is no longer being supported and thus the MAB meta tracker is being closed. 

@Lee - thanks for your patience, apologies that it's taking so long to track down the issue.
Comment 9 Miklos Vajna 2013-05-03 16:32:42 UTC
I have an idea what's going on here: when exporting the odf bugdoc to doc, we write the PlcfHdd table of doc in a way that disabled footers are actually exported as enabled empty footers, and I think that causes the problem.

I plan to fix this soon.
Comment 10 Commit Notification 2013-05-06 11:12:01 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=4144cd5a851466778004af9de98dbcfb019067bb

fdo#42144 WW8 export: avoid writing pointless empty footers



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 11 Miklos Vajna 2013-05-06 11:25:09 UTC
-4-0 review: https://gerrit.libreoffice.org/3797
Comment 12 Commit Notification 2013-05-06 14:58:37 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "libreoffice-4-0":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=ea2603200b46f460f34c930770d69db74a164bde&h=libreoffice-4-0

fdo#42144 WW8 export: avoid writing pointless empty footers


It will be available in LibreOffice 4.0.4.

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.