Bug 116339

Summary: FILESAVE DOCX SharePoint Server 2010 web editor is unable to edit DOCX files saved in LibreOffice
Product: LibreOffice Reporter: Gabor Kelemen (allotropia) <kelemeng>
Component: WriterAssignee: Not Assigned <libreoffice-bugs>
Status: NEW ---    
Severity: normal CC: aron.budea, libreoffice
Priority: medium Keywords: filter:docx
Version: Inherited From OOo   
Hardware: All   
OS: All   
See Also: https://bugs.documentfoundation.org/show_bug.cgi?id=135444
Whiteboard:
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 104528, 121362    
Attachments: Original file created in Microsoft Word 2013.
The file saved in LibreOffice 5.4.5
The manually fixed file.
Screenshot of the problem in SP 2010

Description Gabor Kelemen (allotropia) 2018-03-10 15:41:55 UTC
Created attachment 140546 [details]
Original file created in Microsoft Word 2013.

Tested with the 14.0.7006 version of Microsoft SharePoint 2010 Server web editor.

Microsoft's SharePoint Server 2010 offers a web editor to edit DOCX files. This function doesn't work with DOCX files saved with LibreOffice. The cause for this issue is that there are small differences in the word/fontTable.xml and word/settings.xml files saved by Microsoft Office and LibreOffice.

I was able to repair the file based on the DOCX saved with Microsoft Office 2013. I made the following changes in the word/fontTable.xml file:

Original word/fontTable.xml:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<w:fonts xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><w:font w:name="Times New Roman"><w:charset w:val="00"/><w:family w:val="roman"/><w:pitch w:val="variable"/></w:font><w:font w:name="Symbol"><w:charset w:val="02"/><w:family w:val="roman"/><w:pitch w:val="variable"/></w:font><w:font w:name="Arial"><w:charset w:val="00"/><w:family w:val="swiss"/><w:pitch w:val="variable"/></w:font><w:font w:name="Liberation Serif"><w:altName w:val="Times New Roman"/><w:charset w:val="ee"/><w:family w:val="roman"/><w:pitch w:val="variable"/></w:font><w:font w:name="Times New Roman"><w:charset w:val="01"/><w:family w:val="swiss"/><w:pitch w:val="default"/></w:font><w:font w:name="Tahoma"><w:charset w:val="01"/><w:family w:val="swiss"/><w:pitch w:val="default"/></w:font><w:font w:name="Carlito"><w:altName w:val="Calibri"/><w:charset w:val="01"/><w:family w:val="swiss"/><w:pitch w:val="default"/></w:font><w:font w:name="Trajan Pro"><w:charset w:val="01"/><w:family w:val="swiss"/><w:pitch w:val="default"/></w:font><w:font w:name="H-Helvetica Thin"><w:charset w:val="01"/><w:family w:val="swiss"/><w:pitch w:val="default"/></w:font></w:fonts>

Modified word/fontTable.xml:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<w:fonts xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><w:font w:name="Times New Roman"><w:charset w:val="00"/><w:family w:val="roman"/><w:pitch w:val="variable"/></w:font><w:font w:name="Symbol"><w:charset w:val="02"/><w:family w:val="roman"/><w:pitch w:val="variable"/></w:font><w:font w:name="Arial"><w:charset w:val="00"/><w:family w:val="swiss"/><w:pitch w:val="variable"/></w:font><w:font w:name="Liberation Serif"><w:altName w:val="Times New Roman"/><w:charset w:val="ee"/><w:family w:val="roman"/><w:pitch w:val="variable"/></w:font><w:font w:name="Tahoma"><w:charset w:val="01"/><w:family w:val="swiss"/><w:pitch w:val="default"/></w:font><w:font w:name="Carlito"><w:altName w:val="Calibri"/><w:charset w:val="01"/><w:family w:val="swiss"/><w:pitch w:val="default"/></w:font><w:font w:name="Trajan Pro"><w:charset w:val="01"/><w:family w:val="swiss"/><w:pitch w:val="default"/></w:font><w:font w:name="H-Helvetica Thin"><w:charset w:val="01"/><w:family w:val="swiss"/><w:pitch w:val="default"/></w:font></w:fonts>

Note that the second mention of the “Times New roman” font has been removed (This particular line):
<w:font w:name="Times New Roman"><w:charset w:val="01"/><w:family w:val="swiss"/><w:pitch w:val="default"/></w:font>

Microsoft Office has a different method for describing font in the word/fontTable.xml. This is how it looks in the DOCX saved by Microsoft Office 2013:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<w:fonts xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml" mc:Ignorable="w14 w15"><w:font w:name="Symbol"><w:panose1 w:val="05050102010706020507"/><w:charset w:val="02"/><w:family w:val="roman"/><w:pitch w:val="variable"/><w:sig w:usb0="00000000" w:usb1="10000000" w:usb2="00000000" w:usb3="00000000" w:csb0="80000000" w:csb1="00000000"/></w:font><w:font w:name="Times New Roman"><w:panose1 w:val="02020603050405020304"/><w:charset w:val="EE"/><w:family w:val="roman"/><w:pitch w:val="variable"/><w:sig w:usb0="E0002EFF" w:usb1="C0007843" w:usb2="00000009" w:usb3="00000000" w:csb0="000001FF" w:csb1="00000000"/></w:font><w:font w:name="Courier New"><w:panose1 w:val="02070309020205020404"/><w:charset w:val="EE"/><w:family w:val="modern"/><w:pitch w:val="fixed"/><w:sig w:usb0="E0002AFF" w:usb1="C0007843" w:usb2="00000009" w:usb3="00000000" w:csb0="000001FF" w:csb1="00000000"/></w:font><w:font w:name="Wingdings"><w:panose1 w:val="05000000000000000000"/><w:charset w:val="02"/><w:family w:val="auto"/><w:pitch w:val="variable"/><w:sig w:usb0="00000000" w:usb1="10000000" w:usb2="00000000" w:usb3="00000000" w:csb0="80000000" w:csb1="00000000"/></w:font><w:font w:name="Calibri"><w:panose1 w:val="020F0502020204030204"/><w:charset w:val="EE"/><w:family w:val="swiss"/><w:pitch w:val="variable"/><w:sig w:usb0="E00002FF" w:usb1="4000ACFF" w:usb2="00000001" w:usb3="00000000" w:csb0="0000019F" w:csb1="00000000"/></w:font><w:font w:name="Trajan Pro"><w:altName w:val="Times New Roman"/><w:panose1 w:val="00000000000000000000"/><w:charset w:val="00"/><w:family w:val="roman"/><w:notTrueType/><w:pitch w:val="variable"/><w:sig w:usb0="00000003" w:usb1="00000000" w:usb2="00000000" w:usb3="00000000" w:csb0="00000001" w:csb1="00000000"/></w:font><w:font w:name="H-Helvetica Thin"><w:altName w:val="Times New Roman"/><w:panose1 w:val="00000000000000000000"/><w:charset w:val="00"/><w:family w:val="roman"/><w:notTrueType/><w:pitch w:val="default"/></w:font><w:font w:name="Tahoma"><w:panose1 w:val="020B0604030504040204"/><w:charset w:val="00"/><w:family w:val="swiss"/><w:notTrueType/><w:pitch w:val="variable"/><w:sig w:usb0="00000003" w:usb1="00000000" w:usb2="00000000" w:usb3="00000000" w:csb0="00000001" w:csb1="00000000"/></w:font><w:font w:name="Cambria"><w:panose1 w:val="02040503050406030204"/><w:charset w:val="EE"/><w:family w:val="roman"/><w:pitch w:val="variable"/><w:sig w:usb0="E00002FF" w:usb1="400004FF" w:usb2="00000000" w:usb3="00000000" w:csb0="0000019F" w:csb1="00000000"/></w:font></w:fonts>

Note that Microsoft Office has some additional tags like “w:panose1” and “w:sig”. It seems that this makes it possible to store properties for the same font multiple times in this particular file.

The word/settings.xml also needed some modifications:

Original word/settings.xml:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<w:settings xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"><w:zoom w:percent="100"/><w:defaultTabStop w:val="708"/><w:compat><w:compatSetting w:name="compatibilityMode" w:uri="http://schemas.microsoft.com/office/word" w:val="14"/><w:compatSetting w:name="overrideTableStyleFontSizeAndJustification" w:uri="http://schemas.microsoft.com/office/word" w:val="1"/><w:compatSetting w:name="enableOpenTypeFeatures" w:uri="http://schemas.microsoft.com/office/word" w:val="1"/><w:compatSetting w:name="doNotFlipMirrorIndents" w:uri="http://schemas.microsoft.com/office/word" w:val="1"/></w:compat><w:themeFontLang w:val="hu-HU" w:eastAsia="" w:bidi=""/></w:settings>

Modified word/settings.xml:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<w:settings xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"><w:zoom w:percent="100"/><w:defaultTabStop w:val="708"/><w:compat><w:compatSetting w:name="compatibilityMode" w:uri="http://schemas.microsoft.com/office/word" w:val="14"/><w:compatSetting w:name="overrideTableStyleFontSizeAndJustification" w:uri="http://schemas.microsoft.com/office/word" w:val="1"/><w:compatSetting w:name="enableOpenTypeFeatures" w:uri="http://schemas.microsoft.com/office/word" w:val="1"/><w:compatSetting w:name="doNotFlipMirrorIndents" w:uri="http://schemas.microsoft.com/office/word" w:val="1"/></w:compat><w:themeFontLang w:val="hu-HU"/><w:clrSchemeMapping w:bg1="light1" w:t1="dark1" w:bg2="light2" w:t2="dark2" w:accent1="accent1" w:accent2="accent2" w:accent3="accent3" w:accent4="accent4" w:accent5="accent5" w:accent6="accent6" w:hyperlink="hyperlink" w:followedHyperlink="followedHyperlink"/><w:shapeDefaults><o:shapedefaults v:ext="edit"/></w:shapeDefaults></w:settings>

Note, that the following tags had been added to w:settings: “xmlns:o” and “xmlns:v”

The parameters of the w:themeFontLang tag has been changed from “<w:themeFontLang w:val="hu-HU" w:eastAsia="" w:bidi=""/>” to <w:themeFontLang w:val="hu-HU"/>.

Also, the “w:clrSchemeMapping” and “w:shapeDefaults” tags have been added to the end of the document.

After making these modifications, SharePoint's web editor was able to open the document for editing.

These method was only tested with the provided DOCX file, different documents might need further steps to ensure compatibility with the SharePoint web editor.

Steps to reproduce:
1. Download the following file: SharePoint-editor-testfile-LO54.docx
2. Rename the file to ZIP: SharePoint-editor-testfile-LO54.zip
3. Extract the zip file.
4. Edit the word/fontTable.xml and word/settings.xml according to the description above.
5. Compress the modified files as zip and rename it to DOCX.
6. Upload the file to a SharePoint server, and try the web editor.

Actual results:
Modifications are needed on XML level to make the SharePoint Server 2010 web editor work with DOCX files saved in LibreOffice.

Expected results:
LibreOffice should be able to create DOCX files compatible with SharePoint Server 2010 web editor out of the box.
Comment 1 Gabor Kelemen (allotropia) 2018-03-10 15:42:18 UTC
Created attachment 140547 [details]
The file saved in LibreOffice 5.4.5
Comment 2 Gabor Kelemen (allotropia) 2018-03-10 15:44:32 UTC
Created attachment 140548 [details]
The manually fixed file.
Comment 3 Buovjaga 2018-03-14 14:51:21 UTC
Assuming this is confirmed by the Hungarian team -> NEW
Comment 4 Gabor Kelemen (allotropia) 2018-03-14 14:59:30 UTC
Created attachment 140631 [details]
Screenshot of the problem in SP 2010

"This document cannot be opened for editing"
Comment 5 QA Administrators 2019-11-13 03:33:05 UTC Comment hidden (obsolete, spam)
Comment 6 QA Administrators 2022-11-06 03:37:37 UTC Comment hidden (spam)