Bug 70578 - RTF import: "Normal" paragraph style not imported
Summary: RTF import: "Normal" paragraph style not imported
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
3.5 all versions
Hardware: All All
: medium normal
Assignee: Michael Stahl (allotropia)
URL:
Whiteboard: BSA target:4.4.0 target:4.3.0.1
Keywords: filter:rtf, regression
Depends on:
Blocks:
 
Reported: 2013-10-17 15:04 UTC by Kai
Modified: 2022-05-01 04:41 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Screenshot of correct/incorrect document render; test document. (35.59 KB, application/zip)
2013-10-17 15:04 UTC, Kai
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kai 2013-10-17 15:04:46 UTC
Created attachment 87796 [details]
Screenshot of correct/incorrect document render; test document.

Attached to this issue is a .zip file containing three things:

1. An RTF file which duplicates the issue (test.rtf)
2. A screenshot of how the document renders in MS Word, Ted, and various other programs (Correct.png)
3. A screenshot of how the document renders in LibreOffice (Incorrect.png)

This issue happens in version 4.1, which I downloaded and installed on Windows, and also in a Linux version of 3.5 which I use as a headless server for converting documents, so it is clearly a platform-agnostic issue which has occurred since at least version 3.5.
Operating System: All
Version: 4.1.1.2 release
Comment 1 Thomas van der Meulen [retired] 2013-10-21 09:21:08 UTC
Thank you for your bug report, I can reproduce this bug running 
Version: 4.1.3.1
Build ID: b42498da0e3f91b17e51b55c8295ec4f8f22087
OS: Mac osx 10.8.5. 

Tip for next time: Please set the version to the earliest version that you hat this problem.
Comment 2 Cor Nouws 2013-10-31 21:19:00 UTC
Hi Kai,
Would be interesting to see if the file opens fine in both programs if it were made with proper formatting (styles, not a mixure of all sort of stuff).

That could also lead to a clear definition of the possible problem.
thanks,
Cor
Comment 3 retired 2014-05-04 13:03:16 UTC
Displays correctly in LO 4.2.3.3 as single page (instead of two, as shown in the sample.zip showing the issue).

Interestingly the issue is back in latest nightly
Version: 4.3.0.0.alpha1+
Build ID: f76026a43acc65465882924796d93e635c35fd90
TinderBox: MacOSX-x86@49-TDF, Branch:master, Time: 2014-05-04_06:32:55

So marking regression. Sadly this worked, but in latest nightly is broken again, with the same problem as originally reported here.
Comment 4 Michael Stahl (allotropia) 2014-06-16 10:11:21 UTC
Subtitle style applied: 0 line spacing in Word, 0.77/0.39 line spacing in Writer

apparently the old RTF import filter did not import the "Subtitle" paragraph style at all

the problem is that in Word the Subtitle style inherits from "Normal" which has 0 line spacing, in Writer it inherits from "Heading" which has the 0.77/0.39 line spacing

DOCX file is imported with proper Subtitle inheritance from "Default Style"

aha... problem is in the stylesheet:

{\stylesheet{\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs20\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \snext0 Normal;}

the Normal style does not have "\s0" style index; apparently that's implicit?

RTF spec says:

"For <style>, both <styledef> and <stylename> are optional; the default is paragraph style 0."

ok, implementing that wasn't hard...

... but now a unit test breaks, and ... holy crap, this is horrible...
Comment 5 Commit Notification 2014-06-17 16:48:49 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=6c0e1270889deb513f961f864dfc1c02ee8705f4

fdo#70578: writerfilter RTF import: by default style is para style 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 6 Commit Notification 2014-06-17 16:50:23 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-4-3":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=051e6fefda2411d93cb4bbe4cb3bbbd60861d8fc&h=libreoffice-4-3

fdo#70578: writerfilter RTF import: by default style is para style 0


It will be available in LibreOffice 4.3.

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 7 Michael Stahl (allotropia) 2014-06-17 17:08:43 UTC
hopefully fixed now, and in a way that should not regress the Novell
bug cited in SeeAlso since for the first time we implement Word's
insane interpretation of \sN ...
Comment 8 Robinson Tryon (qubit) 2015-12-17 12:23:11 UTC
Migrating Whiteboard tags to Keywords: (filter:rtf)
Replace rtf_filter -> filter:rtf.
[NinjaEdit]