Bug 153296 - FILESAVE DOCX VML shapetype is not detected as preset shape by Word
Summary: FILESAVE DOCX VML shapetype is not detected as preset shape by Word
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.6.0.0 alpha0+
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:7.6.0
Keywords:
Depends on:
Blocks: FontWork-WordArt 128568 VML-Shapes
  Show dependency treegraph
 
Reported: 2023-01-31 16:46 UTC by Regina Henschel
Modified: 2023-02-02 17:36 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
SlantUp Fontwork shape (71.21 KB, application/vnd.oasis.opendocument.text)
2023-01-31 16:46 UTC, Regina Henschel
Details
ArchUpCurve (17.95 KB, application/vnd.oasis.opendocument.text)
2023-01-31 17:04 UTC, Regina Henschel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Regina Henschel 2023-01-31 16:46:07 UTC
Created attachment 185033 [details]
SlantUp Fontwork shape

Open attached document and save it to docx format.
Open the docx document in Microsoft Word and save it without changes.
Open the saved document in LibreOffice.

Error: LibreOffice does not show the shape. When you look in the Navigator you see, that the shape exists.

The whole process has two main errors:
(1) LibreOffice does not write the markup in a way, that Word detects, that it is one of the preset WordArt shapetypes.
(2) When Word saves the file it writes the shape as having a custom geometry. But LibreOffice is not able to import custom geometry.

This bug report will track problem (1).

The shapetype "SlantUp" was chosen, because it will be exported as VML shape and not as DML shape even in released LibreOffice.
Comment 1 Regina Henschel 2023-01-31 17:04:12 UTC
Created attachment 185035 [details]
ArchUpCurve

Open attached file in a current LO daily. Because it has a bitmap fill it will be written as VML shape, when the file is saved to docx.

Save the file to docx and open the saved file in Word. Error: There is no WordArt but a rectangle.

This is the same problem as (1). But here it is so, that no WordArt shape is written at all.

Root cause is the same. The file "vml-shape-types" (located in the installation directory of LO in share/filter folder) which is used for export of shapes to VML, is not suitable for Fontwork shapes. In case of 'ArchUpCurve' the markup is simply missing in that file. It is " 144 - textArchUp " in that file.

The file is likely neither suitable for other shapes with handles, but I have not tested that. Other shapes than Fontwork shapes are saved as DML shape and use the VML only as Fallback. And because current MS Word is able to read DML shapes, it ignores the Fallback. Errors in the Fallback are only detected, when you use a version before MS Word 2010.
Comment 2 Regina Henschel 2023-01-31 19:53:56 UTC
Work has started in https://gerrit.libreoffice.org/c/core/+/146311.
Comment 3 Stéphane Guillou (stragu) 2023-02-01 09:19:37 UTC
Reproduced with:

Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: ec4babad021218b75dfe8534985d7db525edde69
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

and:

Microsoft® Word for Microsoft 365 MSO (Version 2212 Build 16.0.15928.20196) 64-bit
Comment 4 Commit Notification 2023-02-01 17:18:17 UTC
Regina Henschel committed a patch related to this issue.
It has been pushed to "master":

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

tdf#153296 improved markup for VML shapetype of Fontwork

It will be available in 7.6.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 5 Regina Henschel 2023-02-01 17:44:45 UTC
The problem noticed with Fontwork shapes exists the same way for other types of custom shapes too. Only that for other shape types the VML Fallback is usually not used.

The patch adds a map with the correct markup for Fontwork shapes. That is not a complete fix. For other types of custom shapes still a not suitable markup is used.

I think the basic idea for the "vml-shape-types" file is wrong. It generates the markup from the definitions of preset shapes in OOXML. Instead the markup should be used, that Word generates, when it saves a doc or rtf file to docx in compatibility mode.
Minus the 48 types now handled, there are still 154 types that would have to be fixed. Since the VML fallback is not used for other than Fontwork shapes, I think it is not worth the effort.

Therefore, I do not set the bug to 'Fixed', but will not work on it any further.
Comment 6 Regina Henschel 2023-02-02 17:36:39 UTC
The actual adjustment values are calculated based on the geometry in svx/source/customshapes/EnhancedCustomShapeGeometry.cxx in VML export. Those geometries belong to MS binary file formats. The geometries in OOXML presets which are used in "vml-shape-types" file sometimes differ. The "right-arrow" shape has two handles in OOXML and one handle in MS binary format, for example. Thus the calculated adjustment values do not fit to the geometry in the <v:shapetype> element.