OpenXML (docx without word/styles.xml)
Original issue 453 created by andriy.luts...@crowdin.com on 2015-04-07T12:20:37.000Z:
According to ECMA-376, 4th Edition
(and also https://msdn.microsoft.com/en-us/library/aa982683%28v=office.12%29.aspx)
style (word/styles.xml) definitions part is optional.
Usually this file exists in generated by LO/OO/MSO, but also there some apps which don't create this file.
In result of processing this (attached) docx file we obtain zip file only with [Content_Types].xml.
Solution of this issue:
File
okapi/okapi/filters/openxml/src/main/java/net/sf/okapi/filters/openxml/OpenXMLFilter.java in method nextInZipFile() in condition if(nZipType==MSWORD):
line 694:
if (sEntryName.equals("word/styles.xml"))
change to:
if (sEntryName.equals("word/document.xml"))
and line 704-705:
(sEntryName.equals("[Content_Types].xml") || // but don't do Content_Types
sEntryName.equals("word/styles.xml"))) // and styles a second time
change to:
(sEntryName.equals("[Content_Types].xml") || sEntryName.equals("word/document.xml")))
I can't estimate quality of my "hack" but after this fixing processing of attached document finished successfully.
Tested on okapi's development branch.
Comments (5)
-
Account Deleted -
Account Deleted Comment 2. originally posted by @ysavourel on 2015-04-07T23:41:47.000Z:
-
Account Deleted Comment 3. originally posted by andriy.luts...@crowdin.com on 2015-04-08T09:18:17.000Z:
Thank you Chase
Create fork and push changes
https://code.google.com/r/andriylutskiv-okapi-dev/ -
Account Deleted Comment 4. originally posted by @ysavourel on 2015-04-18T17:43:34.000Z:
This is fixed on my branch; I've added Andriy's source file as a testcase
https://code.google.com/r/tingley-tipp/source/list?name=openxml-refactor
-
- changed status to resolved
This is fixed on dev.
- Log in to comment
Comment 1. originally posted by @ysavourel on 2015-04-07T23:41:36.000Z:
Thanks Andriy, I will take a look when I get back from vacation.
In the future, it is easier if you submit patches in diff form. You can use the 'git diff' command in the git cli, or an equivalent tool in most git GUIs.
(Or even better, you can even create a fork of the okapi repo, commit your changes on a custom branch, then point us where the branch is.)
Thanks!