Bug 48350 - FILESAVE: missing <w:spacing w:after="0" w:before="0"/> in new document.docx (and other MSO 2010 formats)
Summary: FILESAVE: missing <w:spacing w:after="0" w:before="0"/> in new document.docx ...
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
3.5.2 release
Hardware: All All
: high normal
Assignee: Luboš Luňák
URL:
Whiteboard:
Keywords:
: 50092 53551 75017 (view as bug list)
Depends on:
Blocks: DOCX-Paragraph mab4.2
  Show dependency treegraph
 
Reported: 2012-04-05 12:14 UTC by Joachim Otahal
Modified: 2017-05-14 05:50 UTC (History)
9 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joachim Otahal 2012-04-05 12:14:06 UTC
Bug: missing <w:spacing w:after="0" w:before="0"/> in new document(s), save a new document as docx, opening in word 2010 has an extra line after each paragraph.

Seems to be a bug in LO 3.5.1, in this email I refer to TEST1/TEST2 etc to make a distinction between the various documents I did for testing to reproduce:

Steps to reproduce:
New document in LO Writer 3.5.1.
Type a few lines with hitting return at the end.
Save as "office 2007/2010" document TEST1.
Open the document in Office 2010, and an extra empty line is added.
Save the document in Office 2010 as TEST2.
Open in Libreoffice shows the same as office 2010.

Fixing the document in Office 2010: Open TEST2 hit CTRL+A use "Abstand nach dem Absatz entfernen" which should be something like "remove space after each paragraph" in English, save as TEST3. Open in LO, add extra lines and save as TEST4, the extra lines will have the right spacing even when opening in office 2010 again.

Fixing the document in Libreoffice 3.5.1: Open TEST2 hit CTRL+A, right click, paragraph, Intents & Spacing, Below the paragraph, set to 0.0, save as TEST5.

It doesn't matter which you use for fixing, it works in both cases.

Once the document is "fixed" that way you can add extra lines with Libre Office and it will correctly use <w:spacing w:after="0" w:before="0"/> for each new line (see TEST4).

The bug is that LO 3.5.1 doesn't save the spacing information in first place for "new document.docx", although it is "0.00" for a new document. To make LO save the right paragraph spacing you have to change it to 0.1 once (hit OK) and change it to 0.0 again, save as TEST6. LO will save it the way it should in first place.

Document source difference boils down to:

TEST1.docx\word\document.xml (shorted to the important lines)
<w:body>
<w:p>
<w:pPr>
<w:pStyle w:val="style0"/>
</w:pPr>
<w:r>
<w:rPr>
</w:rPr>
<w:t>1</w:t>
</w:r>
</w:p>

TEST6.docx (new document, with changes to 0.1, hit OK and then back to 0.0 + hit OK)
<w:body>
<w:p>
<w:pPr>
<w:pStyle w:val="style0"/>
<w:spacing w:after="0" w:before="0"/>
</w:pPr>
<w:r>
<w:rPr>
</w:rPr>
<w:t>1</w:t>
</w:r>
</w:p>


The "original" test documents are available, but I doubt that they will be needed.
Comment 1 Joachim Otahal 2012-04-05 12:23:05 UTC
The bug is essentially the same if you use .odt, it just does not manifest since the default paragraph spacing is 0.00.

TEST1.odt\content.xml (reduced to the important difference):
<office:automatic-styles>
<style:style style:name="P1" style:family="paragraph" style:parent-style-name="Standard" style:master-page-name="Standard">
<style:paragraph-properties style:page-number="auto"/>
</style:style>
</office:automatic-styles>

TEST6.odt\content.xml (new document, change spacing to 0.1 and back to 0.0):
<office:automatic-styles>
<style:style style:name="P1" style:family="paragraph" style:parent-style-name="Standard">
<style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0cm"/>
</style:style>
<style:style style:name="P2" style:family="paragraph" style:parent-style-name="Standard" style:master-page-name="Standard">
<style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0cm" style:page-number="auto"/>
</style:style>
</office:automatic-styles>


It should always save those spacings.

I guess other spacings are affected too, but they did not yet annoy me : )
Comment 2 Joachim Otahal 2012-04-05 13:00:56 UTC
Thanks for releasing 3.5.2 right after I submitted the bug report.

However: The bug is still there, just tested.
Comment 3 Joel Madero 2012-12-11 19:21:45 UTC
Reproduced on 3.6.3.2

Marking:

New (Confirmed)

Normal (Can prevent high quality/professional work)

High (saving as .docx is pretty normal, adding an extra line after each paragraph is problematic. Furthermore, in some cases this may result in penalties for users such as if a user submits a paper that has a length limit and these extra lines push it over the limit.

Thanks for reporting this one, sorry it took a few months to triage it!
Comment 4 Kevin Suo 2014-03-28 07:43:32 UTC
*** Bug 50092 has been marked as a duplicate of this bug. ***
Comment 5 Kevin Suo 2014-03-28 07:49:42 UTC
(In reply to comment #1)
> I guess other spacings are affected too, but they did not yet annoy me : )

Based on my testing, this at least affected the "paragraph spacing" and "line spacing", see my comment at:
https://www.libreoffice.org/bugzilla/show_bug.cgi?id=50092#c6

(just copy my comment in bug 50092 to here below:)

THE REASON:

* Default style of LO Writer document is SINGLE LINE SPACE, and "0" for AFTER PARAGRAPH.

* However, default style of MS Office 2010 is MULTIPLE LINE SPACE (1.15), and "10 points" AFTER PARAGRAPH, as described in this article: 
http://office.microsoft.com/en-us/word-help/adjust-the-line-spacing-between-text-or-paragraphs-HP010368776.aspx

* When export as .docx, Writer did not set the "<w:spacing..." attributes in "/word/styles.xml", as it is treated as DEFAULT by Writer.
Comment 6 Kevin Suo 2014-03-28 07:55:57 UTC
Added to MAB4.2.
Setting to HIGHEST, as "MAB = HIGHEST".
Comment 7 Kevin Suo 2014-03-28 07:58:42 UTC
*** Bug 51340 has been marked as a duplicate of this bug. ***
Comment 8 Kevin Suo 2014-03-28 08:00:38 UTC
As discussed in bug 51340, this also affects other MSO 2010 file formats (like pptx), so changing the title.
Comment 9 Kevin Suo 2014-03-28 08:17:12 UTC
*** Bug 53551 has been marked as a duplicate of this bug. ***
Comment 10 Kevin Suo 2014-03-28 08:21:42 UTC
*** Bug 75017 has been marked as a duplicate of this bug. ***
Comment 11 René Peinl 2014-03-28 09:11:41 UTC
Although the problem is certainly related, I don't see how bug 51340 is a duplicate to that since it is regarding PPT instead of Word and it is not about creating spacing for a new document, but reading the existing spacing correctly from an existing document.
Comment 12 Kevin Suo 2014-03-28 09:53:41 UTC
(In reply to comment #11)
> Although the problem is certainly related, I don't see how bug 51340 is a
> duplicate to that since it is regarding PPT instead of Word

I changed the title of this bug to include other MSO formats.

> and it is not about creating spacing for a new document, but reading the existing spacing correctly from an existing document.

That is exactly the same issue:

1. IMPORT:

When LibreOffice opens a MSO 2007/10/13 file, it should apply the correct PARAGRAPH SPACE and LINE HEIGHT, when para space and line height is NOT SET in the xml file:
  * PARAGRAPH SPACE: should be the same as MSO 2007/10/13 (for Word format, it's 1.15; for PPT, I dont know)
  * LINE HEIGHT: should be the same as MSO 2007/10/13 (for Word format, it's 10 points after each paragraph; for PPT, I dont know either, should look into the microsoft site.)

2. EXPORT:

When LibreOffice save a file as MSO 2007/2010/2013 format, it should set the PARAGRAPH SPACE and LINE HEIGHT in the xml file. Doing this will avoid confusion between applications.

When the above IMPORT issue is fixed, the EXPORT part is not necessary if users are using the newer versions of LO with the fix included. But we'd better also fix the EXPORT part because someone may open your file in an older LO version and see a different view.

To see if your PPTX issue is a duplicate to this one, I have to see in the PPTX xml file if the line height is really not set (i.e., default value in MSO). (But I am not familier with the pptx style xml file, maybe someone can help?)
If it's not set, then MSO opens it as 1.5 line height and LO opens as single line height --> same issue.
Comment 13 Kevin Suo 2014-03-28 10:12:10 UTC
Adding bug 51340 as see also instead.
Comment 14 Luboš Luňák 2014-05-27 13:44:47 UTC
Does the problem persist with a recent version of LO? I cannot reproduce using the steps given. I can only reproduced using the .docx document from bug #50092, but saving the original file again using a current LO version no longer reproduces the problem.
Comment 15 Joachim Otahal 2014-05-27 18:08:25 UTC
I tested for that issue with LO 4.2.2.1 today, and it looks fine to me. The problem does not appear any more.
From my point of view "RESOLVED".
Comment 16 René Peinl 2014-05-27 20:11:01 UTC
Please make sure to test all cases that were merged to this bug. 
In my tests, bug 51340, which was merged against my advice with this one, is still not resolved.
Comment 17 Luboš Luňák 2014-05-28 10:26:11 UTC
If your bugreport was closed incorrectly as a duplicate of this one, just reopen it.

I'm closing this bugreport as the original problem no longer occurs.