NAV2015 - Build 40459
We have a functionality where users can create word documents for a record. This is stored in a Blob field; nothing special so far.
Here's where it gets interesting:
If I save my document (before importing it) via NAVWordHelper.CallSaveAs:
- If my Word application default language is Dutch (even with English also present) it will work fine;
- If my Word application default language is English (with or without Dutch present), it produces a "Document appears to be corrupted" error
However:
If I save my document (before importing it) via NAVWordHelper.CallSaveAsFormat with wdFormatStrictOpenXMLDocument format:
- If my Word application default language is English (with or without Dutch present) it will work fine;
- If my Word application default language is Dutch (even with English also present), it produces a "Document appears to be corrupted" error
Windows regional settings have no impact on either set of results.
Other information:
- I have not yet tested with other languages, but I would have thought that OpenXmlFormat would be language independent.
- It seems that only Dutch (Netherlands) is causing an issue with the wdFormatStrictOpenXMLDocument - I have tested Arabic (Iraq), Chinese (PRC), Dutch (Belgium) and German and they all seem to work well
- Blob compression settings have no impact.
- The corruption seems to be present in the Styles.xml at least
- The corruption might be linked to collation, since in the corrupted file (Styles.xml) "Colorful" is consistently represented as Col5rful (as in w:name="Col5rful List Accent 4")
- Using TextEncoding other than Windows while importing/exporting the blobs produces I/O errors - most likely because TextMode = FALSE.
- Using TextEncoding in the CreateOutStream/CreateInStream functions likewise has no effect
- Environment is NAV2015 - Build 40459
- I have tried several other methods of storage, but none have proved multilingually sound, so far
Edit: updated for testing of additional languages
Answers
I think I may have found the cause (or, in any case, a solution). It seems that the problem is caused by importing using NAV instreams to read the file. I have used a .NET filestream to import and export and that seems to have done it.
I hope this solves your issue as well!
Peter Conijn
-The Learning Network-