Bug 32613 - RTF -- Wrapping text around images fails to export properly
Summary: RTF -- Wrapping text around images fails to export properly
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: x86 (IA32) Windows (All)
: medium normal
Assignee: Miklos Vajna
URL:
Whiteboard: target:4.4.0
Keywords: filter:rtf
Depends on:
Blocks: RTF
  Show dependency treegraph
 
Reported: 2010-12-23 09:58 UTC by Steven W
Modified: 2015-12-17 05:46 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
writer document reproducing the issue (18.98 KB, application/vnd.oasis.opendocument.text)
2010-12-24 04:58 UTC, Miklos Vajna
Details
Here's a screenshot from MS Word Viewer 2003 (23.03 KB, image/png)
2011-01-11 21:33 UTC, Steven W
Details
This RTF file demonstrates some problems with import too (273.82 KB, application/rtf)
2011-01-12 09:24 UTC, Steven W
Details
partial fix that addresses the regression from go-oo 3.2.x (2.68 KB, text/plain)
2011-01-12 17:12 UTC, Miklos Vajna
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Steven W 2010-12-23 09:58:53 UTC
Using LibreOffice 3 RC 1, if you insert an image on a document, move it to the left-hand side of the page, right click and choose Optimal Page Wrap, and then type some text to the right of the image, and then save it in the RTF format and open it in MS Office, MS Word Viewer or AbiWord, the wrapping is not preserved.  Re-opening in LO the formatting is preserved.
Comment 1 Cédric Bosdonnat 2010-12-24 00:04:04 UTC
Miklos, could you have a look at this one?
Comment 2 Miklos Vajna 2010-12-24 04:58:07 UTC
Created attachment 41422 [details]
writer document reproducing the issue
Comment 3 Miklos Vajna 2010-12-24 05:00:52 UTC
Steven, could you please confirm that the document I attached reproduces the issue? Just to make sure we're talking about the same one.

And yes, looks like it opens in Writer correctly as it implements the flymaincnt5 command group, which is not part of the spec, so nothing else supports that. Given that the WW8 export handles this, it should not be too hard to fix this.
Comment 4 Steven W 2011-01-11 21:12:24 UTC
I downloaded the file you attached, it was an odt.  It opened in LibO, I saved it as an RTF file and it works beautifully; renders fine in Word Viewer 97 and 2003 and Abiword.  I hope the fix isn't difficult to implement!
Comment 5 Steven W 2011-01-11 21:28:29 UTC
(In reply to comment #4)
> I downloaded the file you attached, it was an odt.  It opened in LibO, I saved
> it as an RTF file and it works beautifully; renders fine in Word Viewer 97 and
> 2003 and Abiword.  I hope the fix isn't difficult to implement!

Oh!  Wait a minute, no it's not rendering properly.  Sorry, the graphic was so small I didn't notice it at first!  The words are lined up at the bottom of the graphic in other programs.  So, you have successfully reproduce the issue.
Comment 6 Steven W 2011-01-11 21:33:03 UTC
Created attachment 41900 [details]
Here's a screenshot from MS Word Viewer 2003

As you can see, it ***not*** rendering the same as in LibO.
Comment 7 Miklos Vajna 2011-01-12 06:41:58 UTC
OK, here is my analysis so far. The RTF written by LO is not imported correctly in MSO as LO emits an LO-specific RTF extension to handle the situation. This is not a new bug, the old RTF export had the same issue. (I tested it with Go-OO 3.2.x) If you export the test document as DOC and open it in MSO then it's fine. If you export this doc as RTF in MSO then you get an RTF document which can't be imported properly by LO.

So there are two issues here:

1) I have to figure out what is a document that is opened by both MSO and LO.
2) Modify the exporter to emit such a document.

As a start, I'll give 1) a try tonight.
Comment 8 Steven W 2011-01-12 09:24:00 UTC
Created attachment 41928 [details]
This RTF file demonstrates some problems with import too

This was created in AbiWord and renders fine in MS Word Viewers.  When opening in LibO, the photo shows up, but looks like it's anchored to the edge of the page and looks like some of the text appears in front of the image.  Interesting.
Comment 9 Miklos Vajna 2011-01-12 12:34:37 UTC
Yep, that's what I wrote above - we have an import problem here as well. Though I want to fix the export part of it, as I'm not familiar with the import codebase at the moment.
Comment 10 Miklos Vajna 2011-01-12 17:10:48 UTC
I was wrong, the current situation is worse than in Go-OO 3.2.x.

This file reproduces the problem:

http://cgit.freedesktop.org/~vmiklos/lo-test-files/tree/writer/picture.odt

I'm attaching a patch that does not fix wrapping, but at least makes the picture visible, as 3.2.x did.
Comment 11 Miklos Vajna 2011-01-12 17:12:38 UTC
Created attachment 41945 [details]
partial fix that addresses the regression from go-oo 3.2.x
Comment 12 Miklos Vajna 2011-01-12 18:01:23 UTC
http://people.freedesktop.org/~vmiklos/bugs/fdo32613/

The .orig file is the output of the current exporter. The .rtf file is something Steven wants (it's handmade). The diff is the diff of the two files. As you can see we could just replace the nonstandard flymaincnt+shppict+nonshppict block with a standard shp+shpinst+shprslt, but the current importer can't understand that, and I don't want to break it.

To sum up, that's all I can do for now, I think.
Comment 13 Miklos Vajna 2011-01-12 18:04:30 UTC
Cedric, could you please have a look at the import part? (Don't worry, it never worked, so I consider it a feature that would be nice to have.)

Thanks.
Comment 14 Jean-Baptiste Faure 2011-12-17 15:06:18 UTC
Is this bug fixed in LO 3.5.0-beta1 ? It seems that saving the file to RTF change the anchor of the picture from "to paragraph" to "as character". Does that means that RTF can handle only anchor "as character" ?

Best regards. JBF
Comment 15 Miklos Vajna 2011-12-17 15:19:58 UTC
I *think* older RTF did not support, but recently you can wrap the picture to a shape and then you can have it. This new feature of Word is not supported by the exporter/importer, though ATM.
Comment 16 Steven W 2012-11-07 02:45:10 UTC
Import is now working beautifully.  Export is behaving differently -- when rendered in Word the photo is moved below some of the text.  IMO, export has gotten worse -- I think it would be better to behave as before, lining text up along the bottom of the photo.  


FWIW, when I right click on the file in Windows Explorer I have the option of opening with LibreOffice Calc.  That's an interesting choice.
Comment 17 Steven W 2012-11-07 02:47:53 UTC
I guess I should've mentioned I looking at wrap.rtf, the attachment labeled "This RTF file demonstrates some problems with import too".
Comment 18 Steven W 2012-12-22 23:56:31 UTC
Just test in LO 4 beta 2, to reproduce open wrap.rtf (attached).  Just Save As, and keep the RTF format, close the document and reopen.
Comment 19 Rainer Bielefeld Retired 2013-01-20 08:34:25 UTC
Please consider:
<http://wiki.documentfoundation.org/BugReport_Details#Version>
If you also did this mistake in other Bugs please undo your Version changes there!
Comment 20 bfoman (inactive) 2013-05-16 10:50:29 UTC
This bug has not been touched by its owner for a long time. To make it clearer which bugs should be fixed by someone else please take following action:
- If you are the owner, and you are actively working on the bug, please give it an update. 
- If you are the owner, and you do not plan to work on it in the near future,
please reassign it to the default assignee and change its status to NEW.
Comment 21 Jorendc 2013-12-29 17:20:18 UTC
Bug not assigned to anyone, but had status ASSIGNED. Lets mark it as NEW
Comment 22 Marina Latini (SUSE) 2014-08-28 16:05:09 UTC
added as blocker for meta bug 81234 ([META] RTF filter issues)
Comment 23 Commit Notification 2014-08-29 13:26: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=cb01957aa0ac3caea8e87522116086ac256d4ee2

fdo#32613 RTF export: implemented anchored picture export



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 24 Robinson Tryon (qubit) 2015-12-17 05:46:48 UTC
Migrating Whiteboard tags to Keywords: (filter:rtf)
[NinjaEdit]