Bug 124821 - FILESAVE DOCX: inline (anchored as char) frames moved to end of paragraph on export
Summary: FILESAVE DOCX: inline (anchored as char) frames moved to end of paragraph on ...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.3 all versions
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: implementationError
Depends on:
Blocks: DOCX-Limitations DOCX-Images RTF-Images
  Show dependency treegraph
 
Reported: 2019-04-18 12:36 UTC by Frank Brütting
Modified: 2023-10-12 01:43 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
Original ODT document (52.60 KB, image/png)
2019-04-18 12:48 UTC, Frank Brütting
Details
Document exportet as XLSX (70.28 KB, image/png)
2019-04-18 12:48 UTC, Frank Brütting
Details
Document exported as RTF (54.62 KB, image/png)
2019-04-18 12:48 UTC, Frank Brütting
Details
New document (original odt) (1.86 MB, application/vnd.oasis.opendocument.text)
2019-11-10 16:42 UTC, Frank Brütting
Details
New document (exported docx) (2.16 MB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2019-11-10 16:43 UTC, Frank Brütting
Details
New document (screen shot odt) (526.44 KB, image/png)
2019-11-10 16:51 UTC, Frank Brütting
Details
New document (screen shot rtf) (85.96 KB, image/png)
2019-11-10 16:51 UTC, Frank Brütting
Details
New document (screen shot docx) (521.97 KB, image/png)
2019-11-10 16:52 UTC, Frank Brütting
Details
124821_inlineImage.docx: homemade minimal reproducer (28.04 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2023-06-01 19:38 UTC, Justin L
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Frank Brütting 2019-04-18 12:36:34 UTC
Description:
When I export documents from ODT to XLSX or RTF, I see a lot of corruption of embedded images.





Steps to Reproduce:
When I embed images in my documents, I usually just caption them, change the size and often anchor them “as character”, in order to put several images in one line with a few spaces of distance in between.

The document needs to be exported and reopened for the corruption taking effect.

Actual Results:
All my captioned images get either displaced and overlapped (XLSX) or get lost entirely (RTF).

Expected Results:
Well, I expect those images to stay the same of course.


Reproducible: Always


User Profile Reset: No



Additional Info:
I can’t upload my confidential documents, but I try to upload some screen shots, so that you see what I mean.
Comment 1 Frank Brütting 2019-04-18 12:48:11 UTC
Created attachment 150852 [details]
Original ODT document
Comment 2 Frank Brütting 2019-04-18 12:48:35 UTC
Created attachment 150853 [details]
Document exportet as XLSX
Comment 3 Frank Brütting 2019-04-18 12:48:52 UTC
Created attachment 150854 [details]
Document exported as RTF
Comment 4 raal 2019-04-18 15:15:28 UTC
Hello,

Thank you for filing the bug. Please send us a sample document, as this makes it easier for us to verify the bug. 
I have set the bug's status to 'NEEDINFO', so please do change it back to 'UNCONFIRMED' once you have attached a document.
(Please note that the attachment will be public, remove any sensitive information before attaching it.)
How can I eliminate confidential data from a sample document?
https://wiki.documentfoundation.org/QA/FAQ#How_can_I_eliminate_confidential_data_from_a_sample_document.3F
Thank you
Comment 5 QA Administrators 2019-10-16 02:30:23 UTC Comment hidden (obsolete)
Comment 6 Frank Brütting 2019-11-10 16:42:11 UTC
Created attachment 155680 [details]
New document (original odt)
Comment 7 Frank Brütting 2019-11-10 16:43:23 UTC
Created attachment 155681 [details]
New document (exported docx)
Comment 8 Frank Brütting 2019-11-10 16:49:14 UTC
I created and uploaded a new document. When I just insert the images without captions, the “anchoring as text with spaces in beetween” breaks for the second row.

When I additionally add captions to all images:

* In docx:
    - The spacing between the first image and the text gets lost
    - the manual spaces between images 2 and 3 get lost, additionall, the spacing between these two images and the text line above gets shrinked.

* In rtf:
    - The output file gets a size of 67 MB, whereas the source has 2 MB
    - All images get lost
    - The caption of the first image is shown left of the image placeholder instead of below
    - The image placeholders 2 and 3 look stacked on top of each other.
Comment 9 Frank Brütting 2019-11-10 16:51:13 UTC
Created attachment 155682 [details]
New document (screen shot odt)
Comment 10 Frank Brütting 2019-11-10 16:51:44 UTC
Created attachment 155683 [details]
New document (screen shot rtf)
Comment 11 Frank Brütting 2019-11-10 16:52:17 UTC
Created attachment 155684 [details]
New document (screen shot docx)
Comment 12 Frank Brütting 2019-11-10 16:53:34 UTC
* Done with LibreOffice 6.3.3.2 a64200df03143b798afd1ec74a12ab50359878ed (Flatpak)
Comment 13 Dieter 2019-11-12 14:06:31 UTC
I confirm it with

Version: 6.4.0.0.alpha1 (x64)
Build ID: cc57df8f942f239d29cb575ea5a7cb01405db787
CPU threads: 4; OS: Windows 10.0 Build 18362; UI render: GL; VCL: win; 
Locale: de-DE (de_DE); UI-Language: en-US
Calc: threaded

If I open RTF in Word 2016, it looks better, but not good.

When I compare the settings, I could find, that Wrap-Settings of images in odt are "None" and in docx "Optimal". Don't know, if this causes the difference

I assume, that the bug in rtf-file is different. So perhaps it would be good to slit this bug into two different bug reports.
Comment 14 NISZ LibreOffice Team 2021-04-28 09:07:10 UTC
The two frames at the bottom of attachment 155680 [details] are anchored as character and have 0.3 cm spacing in all four directions.

When exported to docx the spacing setting is lost, so they stick together.

This happens because in Word shapes that are anchored as character cannot have a spacing setting, only shapes anchored as any other type.
Comment 15 QA Administrators 2023-04-29 03:29:23 UTC Comment hidden (obosolete, obsolete)
Comment 16 Dieter 2023-05-07 07:16:21 UTC
Retested with

Version: 7.5.3.2 (X86_64) / LibreOffice Community
Build ID: 9f56dff12ba03b9acd7730a5a481eea045e468f3
CPU threads: 4; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL: win
Locale: de-DE (de_DE); UI: en-GB
Calc: CL threaded

Still present in rtf-document
1. Open attachment 150852 [details]
2. Save as RTF and reload

Actual problems:
Image 2 and image 3 overlap
Captions of all 3 images disappear


Still present in docx-document
1. Open attachment 150852 [details]
2. Save as docx
3. Open in Word or MS Office 365

Actual problem
First image is now left from the text (instead of right).
Comment 17 Justin L 2023-06-01 11:42:59 UTC
LO opens the round-tripped file the same way that MS Word opens it. (That is the important part).

Exporting the "distance to text" spacing is not possible - an MS format limitation. (Well, at least using the DOCX frame choices we have made. See bug 154703.)

I believe the concern about the order of the exported as-char-frames is valid. The bottom two captions are "as character" and come before a short string of spaces. On export, the string of spaces is first, followed by the two captioned images.

I tested by placing a "x" as the first character in the paragraph (before the captions) and a y after all of the spaces.
The DOCX export resulted in x......y<image1><image2>

Note that DOC exports the order just fine.

History:
-OOo didn't export to DOCX
-at first LO exported this as to-character, but EVERYTHING looked perfect in 4.3 (although MS Word imported at the end - so obviously already broken).
-broken at import time during transition to using draw frames in 4.4 commit d379d18666aa42031359ca8eb34b0021960347ae.

The export changed in 4.3's commit 8a0fc37a3714752b764d9d9b752913734412d46c
Author: Miklos Vajna on Wed Dec 11 16:08:52 2013 +0100
    DOCX textframe export: when in experimental mode, use DML instead of VML
Comment 18 Justin L 2023-06-01 19:38:35 UTC
Created attachment 187650 [details]
124821_inlineImage.docx: homemade minimal reproducer