Bug 104954 - DOCX Export: Heading Styles are Wrong when Open with MSO 2010 (because of translation conflict of "Heading" and "Title")
Summary: DOCX Export: Heading Styles are Wrong when Open with MSO 2010 (because of tra...
Status: RESOLVED NOTOURBUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
5.2.4.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: notBibisectable, regression
Depends on:
Blocks: CJK
  Show dependency treegraph
 
Reported: 2016-12-28 07:43 UTC by Kevin Suo
Modified: 2016-12-29 14:16 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
Test ODT file (9.36 KB, application/vnd.oasis.opendocument.text)
2016-12-28 07:44 UTC, Kevin Suo
Details
DOCX file saved from the ODT file under LibreOffice 5.3.0 beta2 (4.76 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2016-12-28 07:45 UTC, Kevin Suo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kevin Suo 2016-12-28 07:43:01 UTC
Description:
The attached ODT file contains Title and Heading 1 styles. When I save this file as DOCX in Writer, and reopen with MSO 2010, the heading styles are wrong.

The bug only appear if I am using non-English UI (Simplified Chinese and Traditional Chinese). Bug does not exist if using English UI. Not sure if this issue exists in other non-English UIs.

Steps to Reproduce:
1. Switch to Simplified Chinese UI.
2. Save the attached ODT file as DOCX.
3. Reopen with MSO 2010. Observe the that the text in heading1 style is wrongly center-aligned.
4. Retest with English UI. Observe that the text in heading1 style is correctly left-aligned.

Actual Results:  
The text in heading1 style is wrongly center-aligned when reopen this docx file in MSO 2010

Expected Results:
The text in heading1 style is should be left-aligned.


Reproducible: Always

User Profile Reset: No

Additional Info:


User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:50.0) Gecko/20100101 Firefox/50.0
Comment 1 Kevin Suo 2016-12-28 07:44:10 UTC
Created attachment 129974 [details]
Test ODT file
Comment 2 Kevin Suo 2016-12-28 07:45:46 UTC
Created attachment 129975 [details]
DOCX file saved from the ODT file under LibreOffice 5.3.0 beta2

Reopen this DOCX file in MSO 2010 to observe the wrong style in heading1.
Comment 3 Kevin Suo 2016-12-28 07:56:01 UTC
The bibisect repo only have english UI, so bibist is not possible for this bug.
Comment 4 Kevin Suo 2016-12-28 08:33:56 UTC
Do not reproduce in version 5.1.1.3 release, so it's a regression.
Comment 5 Kevin Suo 2016-12-28 11:07:53 UTC
The commit:
https://cgit.freedesktop.org/libreoffice/core/commit/?id=bb35db2c709d2d5fd1f86e84478944416cf7f6e0
seems to have caused the issue.

In Chinese, both Heading and Title has the same meaning "标题".
In Writer, the string "Heading" is translated as "标题" in Chinese, all the other headings are based on Heading.
while in MSO the "Title" is "标题".This causes Heading 1 to be based on "Title" in this case. Heading 1 becomes centered as Title has the attribute CENTER.
In Writer "Title" is translated as "大标题" to let it distinguiah with "Heading".

I have changed the translation of Heading from "标题" to "标题 (Heading)" on pootle and hope this workaround works. I can only confirm the result after the next release us out as I am not able to build from master source at this moment.
Even it works, it's not a solution.

Is the export to docx using localized string as style names, rather than IDs?
Comment 6 Kevin Suo 2016-12-29 04:18:13 UTC
The docx file displays correctly in MSO2013 and MSO2016, and also correctly in LibreOffice, apparently this is a MSO2010 bug.

Unzip the docx, in word/styles.xml:

<w:style w:type="paragraph" w:styleId="Style13">
    <w:name w:val="标题"/>
    ......
</w:style>

I change it to:

<w:style w:type="paragraph" w:styleId="Style13">
    <w:name w:val="标题样式"/>
    ......
</w:style>

so that the w:val of this style does not conflict with "Title" style. Then I zip the folder to a new docx file, and reopen with MSO2010, the heading1 style displays correctly.

For any other languages, if you encounter the same issue, you should ask the localization team to change the translation of "Heading" in pootle to something different than the *translation of "Title" as displayed in MSO 2010*.
Comment 7 Kevin Suo 2016-12-29 06:44:14 UTC
Pinged the l10n mailing list at:
http://listarchives.libreoffice.org/global/l10n/msg10583.html
Comment 8 Mark Hung 2016-12-29 12:24:11 UTC
Hi Kevin,

I think you jump to the conclusion to early. A few things to clarify. The assumption that the same ODF file get the same result is not necessary true. It will be better if the content is created from the same procedure, i.e. create three paragraphs and set the style each to Title, Heading1, and Context so we can exclude the possibility that UI affect ODF importing.

On the other hand, if you look at my commit bb35db2c709d2d5fd1f86e84478944416cf7f6e0. I expect the style name to be English. Here in you're result does not work as expected.

<w:style w:type="paragraph" w:styleId="Style13">
    <w:name w:val="标题"/>
    ......
</w:style>

I'd like to spend some time checking this. Altering the translation for the purpose might not be necessary at all.
Comment 9 Mark Hung 2016-12-29 13:27:03 UTC
Kevin,

You're right. Translation of "Heading" conflicts with the translation of "Title" in word. Updating translation is a quick solution for this.
Comment 10 Kevin Suo 2016-12-29 14:04:34 UTC
(In reply to Mark Hung from comment #9)
Thank yoy so much for investigating on this. If you have time, would you please help to identify the root cause/reason for this? Is Word 2010 not using the styleid for styles? I see those styles having different style ids.
Comment 11 Mark Hung 2016-12-29 14:16:47 UTC
Hi Kevin,


Though updating translation seems to be a quick solution here, it also affect style names when exporting and importing ODF. It is my concern ( it's my speculation, not examined yet )  that there might be compatibility issue for different versions of LO if the translation of style name is different.

An alternative solution  is to create new translatable string for "Heading" for the purpose of exporting to docx, so the one in UI would not need to be changed. But it takes much more effort to do that.

And, to answer your question in #10.
There is no document describing how a style is connected to built-in styles in Word. All I know is that style names are recognized.