Bug 116547 - Export of mathematical formula in Writer document to DOCX is displayed incorrectly in Word
Summary: Export of mathematical formula in Writer document to DOCX is displayed incorr...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: filters and storage (show other bugs)
Version:
(earliest affected)
3.5.0 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: bibisectRequest, implementationError, regression
Depends on:
Blocks: DOCX-Corrupted
  Show dependency treegraph
 
Reported: 2018-03-21 17:44 UTC by Alex Thurgood
Modified: 2019-09-04 10:45 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Test Writer document with formulae (14.78 KB, application/vnd.oasis.opendocument.text)
2018-03-21 17:45 UTC, Alex Thurgood
Details
Test docx export of Writer document containing formulae (4.61 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2018-03-21 17:46 UTC, Alex Thurgood
Details
DOCX exported with 3.5.0 (oldest of 43all repo) (3.86 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2018-06-27 17:59 UTC, Buovjaga
Details
How testformuladisplay.docx is displayed in LibreOffice 6.2 (31.53 KB, image/png)
2018-07-01 15:11 UTC, himajin100000
Details
How testformuladisplay35.docx is displayed in LibreOffice 6.2 (25.05 KB, image/png)
2018-07-01 15:12 UTC, himajin100000
Details
How testformuladisplay.docx is displayed in Word 2016 (42.04 KB, image/png)
2018-07-01 15:13 UTC, himajin100000
Details
How testformuladisplay35.docx is displayed in Word 2016 (40.39 KB, image/png)
2018-07-01 15:14 UTC, himajin100000
Details
Display (3.82 KB, text/xml)
2018-08-19 08:54 UTC, himajin100000
Details
Inline (3.83 KB, text/xml)
2018-08-19 08:54 UTC, himajin100000
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Thurgood 2018-03-21 17:44:57 UTC
Description:
I had to create a series of mathematical formulae for a translation in a Writer document (ODT) and then save the document as DOCX to pass on to a client.

When I opened the DOCX document in Word, I was surprised and understandably rather annoyed to discover that the equations were no longer displayed as they appeared in Writer.

I am enclosing a sample of the formulae as entered in Writer and as exported to DOCX along with screenshots.

Steps to Reproduce:
1. Open the Writer document containing the formulae and sample text.
2. Save as DOCX.
3. Open in Word and compare the difference between the Writer document display and the Word document display. Note how the lower limit of the sum symbol has been displaced to right hand side of the sum symbol.

Actual Results:  
Incorrect display of the equation when exported to docx.

Expected Results:
Identical display of the formulae both in Writer and Word.


Reproducible: Always


User Profile Reset: No



Additional Info:


User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:59.0) Gecko/20100101 Firefox/59.0
Comment 1 Alex Thurgood 2018-03-21 17:45:54 UTC
Created attachment 140796 [details]
Test Writer document with formulae
Comment 2 Alex Thurgood 2018-03-21 17:46:32 UTC
Created attachment 140797 [details]
Test docx export of Writer document containing formulae
Comment 3 Jacques Guilleron 2018-03-22 16:03:00 UTC
Hi Alex,

I reproduce too with
LO 6.0.2.1 Build ID: f7f06a8f319e4b62f9bc5095aa112a65d2f3ac89
Threads CPU : 2; OS : Windows 6.1; UI Render : par défaut; 
Locale : fr-FR (fr_FR); Calc: CL
There is a better renderer with a .doc format.
Comment 4 Alex Thurgood 2018-03-27 14:10:12 UTC
Export to Word 97/2000 format with OpenOffice321 shows a correctly displayed formula when opened in a current version of Word.
Comment 5 Alex Thurgood 2018-05-29 08:08:20 UTC
Given comment 4, this is also a regression
Comment 6 Buovjaga 2018-06-27 17:59:33 UTC
Created attachment 143172 [details]
DOCX exported with 3.5.0 (oldest of 43all repo)

Alex: can you open this in Word? If it shows the problem, bibisectRequest can be changed to preBibisect.
Comment 7 himajin100000 2018-07-01 15:11:56 UTC
Created attachment 143249 [details]
How testformuladisplay.docx is displayed in LibreOffice 6.2
Comment 8 himajin100000 2018-07-01 15:12:48 UTC
Created attachment 143250 [details]
How testformuladisplay35.docx is displayed in LibreOffice 6.2
Comment 9 himajin100000 2018-07-01 15:13:33 UTC
Created attachment 143251 [details]
How testformuladisplay.docx is displayed in Word 2016
Comment 10 himajin100000 2018-07-01 15:14:27 UTC
Created attachment 143252 [details]
How testformuladisplay35.docx is displayed in Word 2016
Comment 11 himajin100000 2018-07-01 16:48:58 UTC
um, can you make the same equation if you create it from scratch entirely on Word 2016?

Steps A(for comparison)
a-1. Open Word 2016
a-2. Click Insert tab
a-3. Click Equation in Symbols group
a-4. Click "Large Operator"
a-5. Click the icon with "Summation with Lower limit" tooltip
a-6. Take a look at the equation. entry area for the lower limit is correctly placed under the Σ sign

Steps B
b-1. Open Word 2016
b-2. Click Insert tab
b-3. Click Equation in Symbols group
b-4. Click "Fraction"
b-5. Click the icon with "Stacked Fraction" tooltip
b-6. Click the numerator entry area in the equation.
b-7. Click "Large Operator"
b-8. Click the icon with "Summation with Lower limit" tooltip
b-9. Take a look at the equation. entry area for the lower limit is NOT placed under the Σ sign but is placed like subscript, and this is consistent with the attached image "How testformuladisplay.docx is displayed in Word 2016"

so, I'm guessing this as NOTABUG
Comment 12 himajin100000 2018-07-01 17:00:32 UTC
Additional note:

Microsoft introduced new Equation editor in Office 2007 I guess, throwing away legacy MathType ones.

If I load the attached docx, save the file in doc format, and load in Word 2016, the lower limit is placed under the Σ sign, probably because MathType supports such placement.

(In reply to Alex Thurgood from comment #4)
> Export to Word 97/2000 format with OpenOffice321 shows a correctly displayed
> formula when opened in a current version of Word.

I think "Export to Word 97/2000" is different from "Export to docx", and I don't think the mechanism worked in the past version of Libreoffice. so, not a regression.
Comment 13 Alex Thurgood 2018-07-10 08:26:24 UTC
(In reply to Buovjaga from comment #6)
> Created attachment 143172 [details]
> DOCX exported with 3.5.0 (oldest of 43all repo)
> 
> Alex: can you open this in Word? If it shows the problem, bibisectRequest
> can be changed to preBibisect.


I can open it in Word 2016, but there is no summation symbol displayed at all, so I'm not sure I understand the value of this test document.
Comment 14 Alex Thurgood 2018-07-10 08:32:06 UTC
Hmm, if I've understood the MS volunteer moderator's response here:

https://answers.microsoft.com/en-us/msoffice/forum/msoffice_word-mso_other-mso_2007/summation-symbol-wont-stay-as-written/dd29ed58-fdda-48fe-86d0-63fae0776a8c

It would seem like this is/was a known problem with Microsoft's fantastic new equation engine.
Comment 15 Alex Thurgood 2018-07-10 08:33:28 UTC
If that is true, then they have really shot themselves in the foot...the workaround is to place it in a separate cell in a table ? Jeez
Comment 16 Alex Thurgood 2018-07-10 08:33:49 UTC
Feel free to mark this as notourbug then.
Comment 17 Alex Thurgood 2018-07-10 08:45:17 UTC
I would add that the exported docx file provided by LO always seems to code the equation as "inline" when surrounded by other text characters on the same line. In theory, it should be possible to use "Professional" from the dropdown display tool in Word 2016 to allow the formula to be displayed correctly, however, this action does nothing with the docx file created by LO.


See this thread for information on how it is supposed to work:

https://answers.microsoft.com/en-us/msoffice/forum/msoffice_word-mso_win10-mso_2016/sum-in-math-equation-editor/edb9e93d-e445-44a5-bb12-632e964c10ca
Comment 18 Alex Thurgood 2018-07-10 08:54:17 UTC
Switching between Inline and Display mode in Word 2016 also changes nothing with regard to the exported formulae. They remain unchanged irrespective of the entry chosen.

Why is LO exporting these formulae as Inline and unmodifiable ? Is there some attribute missing in the exported XML ?
Comment 19 Alex Thurgood 2018-07-10 08:56:12 UTC
What this does mean, irrespective of where the problem really lies, is that writing mathematical equations of this type in LO and exporting documents containing them to DOCX is a no-go, which IMHO is a pretty big interop issue.
Comment 20 himajin100000 2018-08-19 08:54:29 UTC
Created attachment 144278 [details]
Display
Comment 21 himajin100000 2018-08-19 08:54:55 UTC
Created attachment 144279 [details]
Inline
Comment 22 himajin100000 2018-08-19 08:58:26 UTC
>Why is LO exporting these formulae as Inline
>Is there some attribute missing in the exported XML ?

probably because LibreOffice is not outputting m:oMathPara element.
see the attachments "Display" and "Inline". These are the files extracted from docx files from Word 2016

https://opengrok.libreoffice.org/xref/core/starmath/source/ooxmlexport.cxx?r=b5867945#33
Comment 23 QA Administrators 2019-09-02 09:23:23 UTC Comment hidden (obsolete)
Comment 24 Alex Thurgood 2019-09-04 10:45:24 UTC
Still reproducible with

Version: 6.4.0.0.alpha0+
Build ID: e04b6f3c0cdacf2a3cdcd3f34bad54c8764ff1ed
CPU threads: 4; OS: Mac OS X 10.14.6; UI render: default; VCL: osx; 
Locale: fr-FR (fr_FR.UTF-8); UI-Language: en-US
Calc: threaded