Bug 135329 - Image not exported to rtf/doc/docx
Summary: Image not exported to rtf/doc/docx
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Justin L
URL:
Whiteboard: target:7.1.0 target:7.2.0 target:7.1....
Keywords: dataLoss
Depends on:
Blocks: Crash-Assert
  Show dependency treegraph
 
Reported: 2020-07-30 19:36 UTC by Telesto
Modified: 2020-12-17 12:42 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Example file (979.56 KB, application/vnd.oasis.opendocument.text)
2020-08-01 21:14 UTC, Telesto
Details
131729_lostImage.odt: minimalized version of the document. (28.85 KB, application/vnd.oasis.opendocument.text)
2020-08-07 08:37 UTC, Justin L
Details
Example file (third) (676.23 KB, application/vnd.oasis.opendocument.text)
2020-08-09 08:25 UTC, Telesto
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Telesto 2020-07-30 19:36:30 UTC
Description:
Image not exported to rtf/doc/docx

Steps to Reproduce:
1. open the attached file
2. Save as RTF/DOC/DOCX
3. File reload

Actual Results:
Image on second page gone

Expected Results:
Not so.. even if this bit of funny document with the image on the second page.. try to drag it :-)


Reproducible: Always


User Profile Reset: No



Additional Info:
Version: 7.1.0.0.alpha0+ (x64)
Build ID: <buildversion>
CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: Skia/Raster; VCL: win
Locale: nl-NL (nl_NL); GI: nl-NL
Calc: CL

and in
3.3.0
Comment 1 raal 2020-08-01 05:56:19 UTC
Please attach the file
Comment 2 Telesto 2020-08-01 21:14:08 UTC
Created attachment 163863 [details]
Example file
Comment 3 Telesto 2020-08-01 21:19:51 UTC
@Justin,
Sorry to bother again. As the whole DOC/DOCX export being a mystery for me.

The bottom image at page 2 doesn't behave 'normally'. Some eccentric anchoring problem which can happen on bad days. 

Is this also they reason why to DOCX/DOC/RTF filter is through the image out of the window (not exporting)
Comment 4 Justin L 2020-08-04 07:53:55 UTC Comment hidden (off-topic)
Comment 5 Telesto 2020-08-04 09:22:32 UTC Comment hidden (off-topic)
Comment 6 Justin L 2020-08-05 07:25:08 UTC Comment hidden (off-topic)
Comment 7 Telesto 2020-08-05 08:08:15 UTC Comment hidden (off-topic)
Comment 8 Justin L 2020-08-05 08:49:45 UTC Comment hidden (off-topic)
Comment 9 Justin L 2020-08-07 08:37:42 UTC
Created attachment 164025 [details]
131729_lostImage.odt: minimalized version of the document.

In this minimized version, the second picture is to-character anchored on the last word "vulputa|te."

Some observations about the documents:
-if you delete the first picture, the second one is there in .docx
-this is one huge paragraph. If you add a paragraph, the second picture is there.
-if you do anything that creates character traits, the second picture is there.

I think the lack of a character run before the picture anchor is the root of the problem. wrtw8nds.cxx tries to write out the entire text in one shot, jumping right over the to-character anchor point?
Comment 10 Telesto 2020-08-07 08:50:14 UTC
(In reply to Justin L from comment #9)
> I think the lack of a character run before the picture anchor is the root of
> the problem. wrtw8nds.cxx tries to write out the entire text in one shot,
> jumping right over the to-character anchor point?

I'm only knowing that anchors + large paragraphs don't go well together. Or smaller paragraphs split across a page and try to insert a shape on the second page. So not sure if this a side-effect of they large anchoring issues, or a problem at the DOC/DOCX/RTF filter specific
Comment 11 Justin L 2020-08-07 09:37:21 UTC
(In reply to Telesto from comment #10)
> I'm only knowing that anchors + large paragraphs don't go well together. So not sure if this a side-effect of they large anchoring
> issues, or a problem at the DOC/DOCX/RTF filter specific
This looks very much like a MAJOR export failure. From what I can see, ONLY pictures anchored AT THE STARTING POINT OF A CHARACTER RUN are exported. All others are ignored.  ::OutFlys(nCurrentPos)
Comment 12 Justin L 2020-08-07 10:02:28 UTC
Since LO 6.4 (bug 87720 comment 43), the default is at-char positioning, so this is really bad...
Comment 13 Telesto 2020-08-07 11:21:25 UTC
FWIW: Cut the image on the second page (minimized example) & past it again. Both images will be present (layout is different, but not the point)
Comment 14 Justin L 2020-08-08 13:01:25 UTC
OK - not as bad as I thought. It seems like just an edge case of searching for the next position before any flies had been processed.

But lots of things here are not matching up in my mind. Especially this one:
commit dce1d0766c5013e35762ab85f263df312901f5f4
Author: Caolán McNamara on Mon Oct 14 13:24:31 2002 +0000
    #i2916# integrate markm character anchoring export impl

http://gerrit.libreoffice.org/c/core/+/100375 tdf# 135329 sw MS export: prevent skipping at-char anchors

http://gerrit.libreoffice.org/c/core/+/100386 tdf#135329 sw MS export: remove effectively dead anchoring code

http://gerrit.libreoffice.org/c/core/+/100387 tdf#135329 sw MS export: don't miss nextAttr fly position
Comment 15 Justin L 2020-08-08 13:34:10 UTC
(In reply to Telesto from comment #13)
> FWIW: Cut the image on the second page (minimized example) & past it again.
Well, pasting puts it at the end of the paragraph for me. If you move it back to the original character anchor, it is lost again.
Comment 16 Telesto 2020-08-08 14:53:15 UTC
(In reply to Justin L from comment #15)
> (In reply to Telesto from comment #13)
> > FWIW: Cut the image on the second page (minimized example) & past it again.
> Well, pasting puts it at the end of the paragraph for me. If you move it
> back to the original character anchor, it is lost again.

True, but the whole anchoring is quirky. 

1. Open the minimal example
2. CTRL+CUT the image on the second page
3. Undo (expected, same result).
4. Save As DOCX 
5. File reload:  Image is present, but image over text (wrap broken)

There is something quite wrong with anchoring handling itself, IMHO (look at my whole list of bug I posted against Meta Wrap/Anchoring). 

And lets maybe there is an issue at the DOCX/DOC side too. I only do know that the behavior is pretty quirky. It can produce all sorts of unpredictable results (from my perspective). There might be a totally logical explanation for this from DEV point of view.
Comment 17 Commit Notification 2020-08-08 16:49:17 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/a5ada62f564b90cf211929baf7694f477a53a445

tdf#135329 sw MS export: prevent skipping at-char anchors

It will be available in 7.1.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 18 Telesto 2020-08-09 08:25:10 UTC
Created attachment 164063 [details]
Example file (third)

1. open the attached file
2. Press Enter at top of the page
3. Save AS DOCX
4. Notice the image gone

5. Save AS ODT will result in a different 'on screen' vs file reload situation (did report this separately)
Comment 19 Commit Notification 2020-08-13 14:54:41 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/245470582c91e9ebb84e53a80afd86b7978e5650

tdf#135329 sw MS export: remove effectively dead anchoring code

It will be available in 7.1.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 20 Commit Notification 2020-08-19 17:46:15 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/c8a95925ca316c2656c81696b1e87c7d5767883d

tdf#135329 sw MS export: don't miss nextAttr fly position

It will be available in 7.1.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 21 Commit Notification 2020-12-08 08:04:12 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/9a8126262a8afba46efbfac5160b5f8cf13c9bd6

tdf#135329 revert sw MS export: prevent skipping at-char anchors

It will be available in 7.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 22 Commit Notification 2020-12-17 12:42:50 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "libreoffice-7-1":

https://git.libreoffice.org/core/commit/d6fe7099092ed74b3a2580e0d95ed9229e262212

tdf#135329 revert sw MS export: prevent skipping at-char anchors

It will be available in 7.1.0.0.beta2.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.