Bug 164627 - docx export: Drop VML fallback for compat14+ documents
Summary: docx export: Drop VML fallback for compat14+ documents
Status: ASSIGNED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: lowest enhancement
Assignee: Justin L
URL:
Whiteboard: target:25.8.0
Keywords: filter:docx
Depends on:
Blocks: OOXML-Shapes DOCX-compatibilityMode-15
  Show dependency treegraph
 
Reported: 2025-01-08 17:41 UTC by Justin L
Modified: 2025-01-10 01:04 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Justin L 2025-01-08 17:41:41 UTC
DOCX specifies two different "shape" markup languages. VML was the first one introduced when DOCX was announced for Word 2007. But Word 2010 defined DML and that has been preferred ever since.

So Word and LO have been writing the following ever since:
    <mc:AlternateContent>
        <mc:Choice Requires="wps">
<!-- DML content -->
        </mc:Choice>
        <mc:Fallback>
<!-- VML content -->
        </mc:Fallback>
    </mc:AlternateContent>

Since LibreOffice has basically always supported DML (since at least 2014), it always uses that Choice (so our VML import code is rarely exercised, tested, and therefore is not very good quality).

MS Word of course also uses the DML definition whenever possible.

Since only Word 2007 cannot handle DML, and since Word 2007, 2010, and 2013 (and almost Word 2016) are all end of life, I don't see much value in providing the VML Fallback content any more. I propose that it should not be written by default. (The user should be able to control this via a config setting. It also should be written for any compat12 documents/when writing specifically to Word 2007 format).

The two benefits will probably be minor/insignificant.
-smaller file size
-faster export time

A LO presentation about this topic by Rohit Deshmukh is at https://prezi.com/vyfyzm_qgmhp/introduction-to-vml-and-dml/

Alternate content
    Alternate content is used for adding both VML and DML in office 2010
    Alternate content has two parts
    Choice : Used in Ms office 2010
    Fallback : Used in MS office 2007

VML TO DML in LO
    LO import only Choice part (i.e. DML) from alternate content and ignore VML part

    Per the Ecma spec: “VML should be considered a deprecated format included in Office Open XML for legacy reasons only.”
    VML was not entirely replaced by DrawingML before submission to Ecma
    Main remaining uses of VML:
    WordprocessingML: OfficeArt shapes, textboxes
    SpreadsheetML/PresentationML: comments, embedded OLE objects
Comment 1 Commit Notification 2025-01-10 00:11:00 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

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

tdf#164627 docx export: consolidate getWordCompatibilityMode()

It will be available in 25.8.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 2 Justin L 2025-01-10 01:04:34 UTC
So, comment 1's commit is just related - needed for checking the compat mode.

Proposed patch to do the work is https://gerrit.libreoffice.org/c/core/+/179979