Bug 142398 - FILESAVE DOCX Several Writer shapes textbox saved incorrectly
Summary: FILESAVE DOCX Several Writer shapes textbox saved incorrectly
Status: RESOLVED DUPLICATE of bug 92525
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Attila Bakos (NISZ)
URL:
Whiteboard: target:7.3.0 target:7.2.0.0.beta2
Keywords: filter:docx
Depends on:
Blocks: Shape-ODF-OOXML-export
  Show dependency treegraph
 
Reported: 2021-05-20 13:08 UTC by NISZ LibreOffice Team
Modified: 2021-06-24 08:34 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Example file from Writer with shapes and added text (23.29 KB, application/vnd.oasis.opendocument.text)
2021-05-20 13:08 UTC, NISZ LibreOffice Team
Details
The original file saved by Writer to docx (26.71 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2021-05-20 13:08 UTC, NISZ LibreOffice Team
Details
Screenshot of the original and exported document side by side in Writer – page 1 (141.20 KB, image/png)
2021-05-20 13:09 UTC, NISZ LibreOffice Team
Details
Screenshot of the original and exported document side by side in Writer – page 2 (139.57 KB, image/png)
2021-05-20 13:09 UTC, NISZ LibreOffice Team
Details
Screenshot of the original and exported document side by side in Writer – page 3 (102.16 KB, image/png)
2021-05-20 13:09 UTC, NISZ LibreOffice Team
Details

Note You need to log in before you can comment on or make changes to this bug.
Description NISZ LibreOffice Team 2021-05-20 13:08:26 UTC
Created attachment 172202 [details]
Example file from Writer with shapes and added text

The attached example file contains Writer shapes that were found to be exported incorrectly to docx: their textbox used to be inside their area, but after save they are resized to the bounding rectangles size.
Steps to reproduce:
    1. Open attached example Writer  file. The shapes contain some text written on them.
    3. Save as .docx, reopen files

Actual results:
In docx, the shapes textboxes size and consequently their texts position is incorrect.

Expected results:
Docx shapes should look like the original .odt shapes.

LibreOffice details:
Version: 7.2.0.0.alpha1+ (x64) / LibreOffice Community
Build ID: 91330c503b7eb91d777978018b66890af87cf8f5
CPU threads: 8; OS: Windows 10.0 Build 18363; UI render: Skia/Raster; VCL: win
Locale: hu-HU (hu_HU); UI: en-GB
Calc: threaded
Comment 1 NISZ LibreOffice Team 2021-05-20 13:08:53 UTC
Created attachment 172203 [details]
The original file saved by Writer to docx
Comment 2 NISZ LibreOffice Team 2021-05-20 13:09:10 UTC
Created attachment 172204 [details]
Screenshot of the original and exported document side by side in Writer – page 1
Comment 3 NISZ LibreOffice Team 2021-05-20 13:09:31 UTC
Created attachment 172205 [details]
Screenshot of the original and exported document side by side in Writer – page 2
Comment 4 NISZ LibreOffice Team 2021-05-20 13:09:49 UTC
Created attachment 172206 [details]
Screenshot of the original and exported document side by side in Writer – page 3
Comment 5 Regina Henschel 2021-05-21 00:38:23 UTC
The example shapes do not have a text box, but a simple label text. The segment is not a custom shape at all.

In case a custGeom is written, a <a:rect ...> has to be generated. For to get the correct rectangle, it is needed to get the property "TextFrames" from "Path" in CustomGeomety. But currently only the preset shape types l, t, r, b are written:
https://opengrok.libreoffice.org/xref/core/oox/source/export/drawingml.cxx?r=af16aa62#3768
https://opengrok.libreoffice.org/xref/core/oox/source/export/drawingml.cxx?r=af16aa62&fi=WriteCustomGeometry#3557

In case of prstGeom there is no need for a <a:rect ...> element. So writing a shape as ooxml-foo (if possible), would solve the <a:rect...> problem. But it has the downside, that reload and export to binary MS formats will loose the shape. And some of our mso-foo shapes do not have a directly corresponding ooxml-shape.

It might help to sort the shapes currently in the floater in the UI in categories
a) work with l, t, r, b
b) do not work with l, t, r, b, but have exactly corresponding ooxml preset shape
c) do not work with l, t, r, b and need ooxml custGeom.
Comment 6 Commit Notification 2021-06-23 10:58:15 UTC
Attila Bakos (NISZ) committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/63cd67e5e18f01aca303131e148c80398a181a41

tdf#92525 tdf#142398: fix export of simple custom shapes

It will be available in 7.3.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 7 Attila Bakos (NISZ) 2021-06-23 11:30:25 UTC

*** This bug has been marked as a duplicate of bug 92525 ***
Comment 8 Commit Notification 2021-06-24 08:34:59 UTC
Attila Bakos (NISZ) committed a patch related to this issue.
It has been pushed to "libreoffice-7-2":

https://git.libreoffice.org/core/commit/0cfa76c0a1883289f8406551d0494cc2a30df926

tdf#92525 tdf#142398: fix export of simple custom shapes

It will be available in 7.2.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.