Bug 146450 - Position of grouped shape in Caption frame off after DOCX export (no image with DOC)
Summary: Position of grouped shape in Caption frame off after DOCX export (no image wi...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.3.0.4 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: bibisected, regression
Depends on:
Blocks: Writer-Images
  Show dependency treegraph
 
Reported: 2021-12-28 11:18 UTC by Telesto
Modified: 2024-08-08 16:53 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Example file (663.22 KB, application/vnd.oasis.opendocument.text)
2021-12-28 11:19 UTC, Telesto
Details
Screenshot (111.62 KB, image/jpeg)
2021-12-28 11:20 UTC, Telesto
Details
Example file (663.89 KB, application/vnd.oasis.opendocument.text)
2022-01-12 17:35 UTC, Telesto
Details
Bibisect log showing all source commits (54.58 KB, text/plain)
2024-08-08 16:50 UTC, Buovjaga
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Telesto 2021-12-28 11:18:48 UTC
Description:
Position of grouped shape in Caption frame after DOCX export

Steps to Reproduce:
1. Open the attached file
2. Save as DOCX
3. File reload

Actual Results:
See screenshot

Expected Results:
Same as original


Reproducible: Always


User Profile Reset: No



Additional Info:
Version: 7.4.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: 9c95415de877af1430ab5b7123e11dedd0ea622c
CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: Skia/Raster; VCL: win
Locale: nl-NL (nl_NL); UI: en-US
Calc: CL
Comment 1 Telesto 2021-12-28 11:19:02 UTC
Created attachment 177171 [details]
Example file
Comment 2 Telesto 2021-12-28 11:20:05 UTC
Created attachment 177172 [details]
Screenshot
Comment 3 Telesto 2021-12-28 11:23:47 UTC
Also in
Version: 6.4.0.0.alpha0+ (x64)
Build ID: c56bf1479cc71d1a2b0639f6383e90c1f7e3655b
CPU threads: 4; OS: Windows 6.3; UI render: default; VCL: win; 
Locale: nl-NL (nl_NL); UI-Language: en-US
Calc: CL

and in
Versie: 4.4.7.2 
Build ID: f3153a8b245191196a4b6b9abd1d0da16eead600
Locale: nl_NL

even more broken with
Versie: 4.1.0.4 
Build ID: 89ea49ddacd9aa532507cbf852f2bb22b1ace28
Comment 4 Telesto 2021-12-28 11:24:59 UTC
Pretty OK with (except for caption on top of image instead of below)
Version: 4.3.7.2
Build ID: 8a35821d8636a03b8bf4e15b48f59794652c68ba
Comment 5 Dieter 2022-01-12 16:19:25 UTC
I confirm it with

Version: 7.4.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: 151c56ed547490a99d912524c0e56b5d6d4a1939
CPU threads: 4; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: de-DE (de_DE); UI: en-GB
Calc: CL

Additional information
Not related to group. If you ungroup images, result is the same.

What happens:
Anchor changes from "To Paragraph" to "To Character". That is bug 94302.
=> RESOLVED DUPLICATE (Feel free to change it to NEW with a short reasoning, if you disagree)

Telesto, would be very very nice, if you spent some more time on analyzing what's going on. I'm sure, this would reduce the amount of bug reports.

*** This bug has been marked as a duplicate of bug 94302 ***
Comment 6 Telesto 2022-01-12 17:35:11 UTC
Created attachment 177499 [details]
Example file

1. Open the attached file
2. Export to DOCX 
3. File Reload -> Fine
4. Select the grouped image bunch
5. Right click Insert caption frame
6. Save 
7. Reload -> Mess
Comment 7 Telesto 2022-01-12 17:45:46 UTC
(In reply to Dieter from comment #5)
> Anchor changes from "To Paragraph" to "To Character". That is bug 94302.

Bug 94302 is about "To Paragraph" to "As Character" (not the same as 'To Character).

Looking it at slightly closer. Anchoring doesn't matter. This happens even everything set to "To Character". Group/Ungroup doesn't matter either.

Shapes still in frame 
Version: 4.3.7.2
Build ID: 8a35821d8636a03b8bf4e15b48f59794652c68ba

So prefer to keep this open until a bibisect is done
Comment 8 Buovjaga 2024-08-08 16:50:44 UTC
Created attachment 195773 [details]
Bibisect log showing all source commits

The oldest of 43max showed the frame in the captioned and saved docx, but without the images (sometimes it crashed when adding the caption). This was still treated as good. In later commits the images were shown again.

There was an intermediate commit where the frame with the images was not shown in the docx. This was skipped.

The end result was a list of 73 potential bad commits. Saving this list to a .txt file, I could script outputting "git show" for all commits:

while IFS="" read -r p || [ -n "$p" ]
do
  git show --no-patch "$p" >> /path/to/tdf146450_bisectlog.txt
done < /path/to/tdf146450_bisect_range.txt

Searching for "caption" in the log file, this pops up:

commit 2c221c8418f7a41963ca594cdb9432f62abbadc8
Author: Matthew Francis <mjay.francis@gmail.com>
Date:   Thu May 28 19:31:50 2015 +0800

    source-hash-7e92d9881f039899262882633712ec0a3de01474
    
    commit 7e92d9881f039899262882633712ec0a3de01474
    Author:     Tushar Bende <tushar.bende@synerzip.com>
    AuthorDate: Wed Feb 26 15:34:58 2014 +0530
    Commit:     Miklos Vajna <vmiklos@collabora.co.uk>
    CommitDate: Wed Feb 26 13:25:41 2014 +0100
    
        fdo#74771 : LibreOffice image captions crash MS Office Word
    
            There was a problem if
            1)Document is created in MS word
            2)then opened in Libreoffice and edited by adding Image and Caption
            3)saved back to docx format
            4)Attempt to open the DOCX file in Word. Word was crashing.
    
            Problem was if any doc is edited in LO by adding image and Caption LO adds image as anchored inside TextBox.
            Which MS word doesn't support(Anchored image inside TextBox).
            Verified code changes on both MSWord2007 & MSWord2010 as it was crashing both earlier.
Comment 9 Buovjaga 2024-08-08 16:53:02 UTC
(In reply to Telesto from comment #6)
> Created attachment 177499 [details]
> Example file
> 
> 1. Open the attached file
> 2. Export to DOCX 
> 3. File Reload -> Fine
> 4. Select the grouped image bunch
> 5. Right click Insert caption frame
> 6. Save 
> 7. Reload -> Mess

To be clear, I used these steps. With a little help from

opt/program/soffice --headless --convert-to "docx:Office Open XML Text" --outdir /path/to/dir /path/to/dir/vvv.odt && SAL_USE_VCLPLUGIN=gen opt/program/soffice --norestore /path/to/dir/vvv.docx

and of course the usual while loop to help with git bisect skip when it crashed upon conversion.