Bug 150835 - FILESAVE ODT->RTF: Images in table jump out of table in Word
Summary: FILESAVE ODT->RTF: Images in table jump out of table in Word
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.0.0.3 release
Hardware: All All
: lowest normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: filter:rtf
Depends on:
Blocks: RTF-Images
  Show dependency treegraph
 
Reported: 2022-09-06 19:13 UTC by Gabor Kelemen (allotropia)
Modified: 2024-08-20 22:35 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
The example file saved as RTF by Writer (153.39 KB, application/msword)
2022-09-06 19:13 UTC, Gabor Kelemen (allotropia)
Details
The original file in Writer, with its RTF version in Word (163.17 KB, image/png)
2022-09-06 19:14 UTC, Gabor Kelemen (allotropia)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gabor Kelemen (allotropia) 2022-09-06 19:13:16 UTC
Created attachment 182270 [details]
The example file saved as RTF by Writer

This is related to bug 140302

When the example file there attachment 169630 [details] is saved to RTF format and opened in Word, the two images in the table on the first page jump out of the table and appear incorrectly on top of each other.

1, Open attachment 169630 [details] in Writer
2, Save as RTF, then open it in Word
3, Compare how the two blue images in the table on the first page appear in Word.

Note: in Word, turning on the "Layout in table cell" option (Format Picture - Layout tab - Advanced - Position tab) seems to put them back in their original place in the table.

Version: 7.5.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: dc92a4d973086ce8a6a5f75ba0f4d4c9ca05537a
CPU threads: 14; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: en-US (hu_HU); UI: en-US
Calc: threaded

Also happens with 7.0, 6.0, 5.0, 4.0. In 3.6 all the images were exported anchored as character, which looked more like the original in case of these, but not in case of the other images in the file.
Wouldn't call this a regression.
Comment 1 Gabor Kelemen (allotropia) 2022-09-06 19:14:29 UTC
Created attachment 182271 [details]
The original file in Writer, with its RTF version in Word
Comment 2 Timur 2022-09-13 08:41:21 UTC
I didn't test, waiting for a fix to come to repo, please test with fix.
Comment 3 Buovjaga 2023-02-03 14:20:48 UTC
Repro and confirmed with office.com

Arch Linux 64-bit, X11
Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 52ebc632b3cfa122dcb178cf28d8dbc7c7c57007
CPU threads: 8; OS: Linux 6.1; UI render: default; VCL: kf5 (cairo+xcb)
Locale: fi-FI (fi_FI.UTF-8); UI: en-US
Calc: threaded
Built on 3 February 2023
Comment 4 Justin L 2024-08-20 14:09:28 UTC
This is the RTF equivalent of DOC export bug 157637.
In LO, the default for tables/shapes is NOT to follow text flow, while the default for Word is to layoutInCell.

This problem is compounded by the fact that when layoutInCell is not true, Word does NOT treat the cell paragraph that the image is anchored in as "the paragraph", but instead it treats the paragraph containing the entire table as "the paragraph", and so any positioning is done relative to "column/para" are done outside of the table.

But there are so many exceptions and special cases with layoutInCell that any kind of mapping would be extremely hard to do. Plus layoutInCell is not a native RTF capability, but is handled via an application-specific-extension name/value pair.

Basically, if LO's shape is (fully contained within the cell OR is wrap-through) AND is vertically and horizontally oriented "to entire paragraph", then export should flag it as "layoutInCell".

It is worth noting that DOCX compat15 ALWAYS treats everything as layoutInCell, even if it is set to false.

That suggests the best solution might be to always flag as layoutInCell if vertical/horizontal orientation is related to paragraph instead of page.
Comment 5 Justin L 2024-08-20 22:35:51 UTC
(In reply to Justin L from comment #4)
> That suggests the best solution might be to always flag as layoutInCell if
> vertical/horizontal orientation is related to paragraph instead of page.
Unfortunately, at the time of export where this is being calculated, we don't even know if it is in a table, let alone whether it fits inside the cell or not. So while certain documents will look better, others will turn into disasters.