Bug 54473 - FILEOPEN DATALOSS: RTF import replaces all custom character styles by "Default", using local formatting instead of character styles
Summary: FILEOPEN DATALOSS: RTF import replaces all custom character styles by "Defaul...
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version: 3.5.0 release
Hardware: All All
: medium major
Assignee: Miklos Vajna
QA Contact:
URL:
Whiteboard: rtf_filter target:4.0.0 target:3.6.5
Keywords: regression
Depends on:
Blocks: 57133
  Show dependency treegraph
 
Reported: 2012-09-04 03:07 UTC by Urmas
Modified: 2012-12-13 08:13 UTC (History)
3 users (show)

See Also:
i915 platform:
i915 features:


Attachments
Saved file with character styles (2.51 KB, text/rtf)
2012-09-04 03:07 UTC, Urmas
Details

Description Urmas 2012-09-04 03:07:29 UTC
Created attachment 66590 [details]
Saved file with character styles

RTF importer in LO manages to fail import character styles which it has itself created.
Comment 1 Mike Kaganski 2012-09-14 22:40:37 UTC
Can't reproduce with LO 3.6.1.2 (rus) on Win7x64.
Comment 2 Urmas 2012-09-17 04:05:19 UTC
Proof?
Comment 3 Mike Kaganski 2012-10-06 10:38:18 UTC
Dear Urmas,
what kind of proof do you need? I see the same picture as in MS Word Viewer, i.e. four words with different formatting applied.

This isn't meant to offend someone; it just indicates that this problem is not reproducible in some specific environment. Thus, it may indicate that the problem is related to some OS(es), or some plugins installed, or something else.

By the way, you failed to indicate your OS, so it may be difficult for devs to track the problem.
Comment 4 Urmas 2012-10-07 02:04:46 UTC
And how the styles applied to those four word are called? They are lost.
Comment 5 Mike Kaganski 2012-10-07 05:45:30 UTC
Aha. So this bug is about loss of character style names, not the styles themselves. This misunderstanding happens when reporter ignores bug reporting guidelines and omits the "what is done", "what is expected" and "what happens instead" report sections :)

Reproducible under the abovementioned environment.

This is the minimal RTF to reproduce:

{\rtf1\ansi
{\stylesheet;
{\*\cs16\ul Anot;}
{\*\cs15\i ForeignTxt;}
}
{\cs16\ul Text }
with 
{\cs15\i character }
formatting
\par }

The word "Text" should have character style "Anot", and "character" should have "ForeignTxt" style applied. But in LO Writer (v. 3.6.2.2) the style is basic.

While preparing this testcase, I came across another bug: if I remove semicolon that goes just after "\stylesheet" then the first style in the stylesheet is ignored. In MS Word Viewer (as well as in MS Word) everything works OK.
Comment 6 Roman Eisele 2012-11-14 18:40:15 UTC
Status should be NEW (confirmed) according to comment #5.
Also improved the summary according to that comment and added Whiteboard tag.
Comment 7 Roman Eisele 2012-11-14 18:49:55 UTC
OK, I can confirm that this problem is still REPRODUCIBLE with
* LibreOffice 3.6.3.2 (Build ID: 58f22d5)
* LOdev 4.0.0.0.alpha0+ (Build ID: 32315e; pull time: 2012-11-13 00:32:26)

It is already reproducible with
* LibreOffice 3.5.0rc3 (Build-ID: 7e68ba2-a744ebf-1f241b7-c506db1-7d53735)
so set Version field to that number (first version in which the bug appears).

But it is NOT reproducible with
* LibreOffice 3.3.0, OOO330m19 (Build:6), tag libreoffice-3.3.0.4
* LibreOffice 3.4.0, OOO340m1 (Build:12)
These Versions import the character styles (more or less) correctly.

So this is a regression (added keyword).

Also changed the Summary again, to make the problem clear:
The custom character styles are all replaced by “Default”;
the document uses local formatting instead of character styles now.
Comment 8 Roman Eisele 2012-11-14 18:54:32 UTC
@ Miklós Vajna:

Hi Miklós, this is a remaining problem of our new RTF import filter. I fear it is not easy to fix this ;-) But it would be nice if you could do something about it, because especially people who like to use character styles (instead of direct/local formatting) for document markup will be angry that all their work is lost, if they open their RTF files with LibreOffice and find that the “Default” character style is used everywhere ...

Thank you very much!
Comment 9 Roman Eisele 2012-11-14 18:56:28 UTC
@ Mike Kaganski:

(In reply to comment #5)
> While preparing this testcase, I came across another bug: if I remove
> semicolon that goes just after "\stylesheet" then the first style in the
> stylesheet is ignored. In MS Word Viewer (as well as in MS Word) everything
> works OK.

Could you please file a separate (new) bug report for this problem, if it is still reproducible with LibreOffice 3.6.3?
(If you CC me: bugs@eikota.de about the new bug report, I will confirm it.)

Thank you very much!
Comment 10 Miklos Vajna 2012-12-04 09:10:58 UTC
I don't see the problem on master (as of today), but I see the problem on -3-6 (as of today). Probably I forgot to backport a fix or so.
Comment 11 Miklos Vajna 2012-12-04 09:37:35 UTC
OK, I think I know what's going on here. By accident, this works in a debug-enabled build. Will fix it properly in a bit.
Comment 12 Not Assigned 2012-12-04 10:00:48 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=41890bf714803969515578b47e63fa9730ea7090

fdo#54473 fdo#57133 fix RTF import of character styles



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 13 Miklos Vajna 2012-12-04 10:24:48 UTC
Resolved in master, -3-6 review: https://gerrit.libreoffice.org/1235
Comment 14 Not Assigned 2012-12-04 11:00:50 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "libreoffice-3-6":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=3d43dc3318a0692287e877b2e70e873372d2c248&g=libreoffice-3-6

fdo#54473 fdo#57133 fix RTF import of character styles


It will be available in LibreOffice 3.6.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.
Comment 15 Roman Eisele 2012-12-13 08:13:37 UTC
VERIFIED as FIXED on Mac OS X (10.6.8, Intel) with

  Version 4.0.0.0.beta1 (Build ID: 87906242e87d3ddb2ba9827818f2d1416d80cc7)
  TinderBox: MacOSX TDF Release, Branch:libreoffice-4-0,
  Time: 2012-12-05_22:13:37

Urmas’ attached sample document is now imported correctly, including the character styles.


@ Miklós:
Thank you very much for fixing this issue! As I have argued in comment #8,
under some circumstances this little bug could have been very annoying,
therefore I regard your fix as very important.

@ Urmas and Mike Kaganski:
Thank you very much for noticing and analyzing this issue!


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.