I have a few documents that were originally uploaded as .doc files with the mimetype of Microsoft Word (application/msword) to alfresco share.
Now I've been able to successfully change the documents extension and update its mime type property to Microsoft Word 2007 (application/vnd.openxmlformats-officedocument.wordprocessingml.document).
But, when the file is downloaded and opened with microsoft word, it throws an error saying that the file format doesn't match the extension.
I thought I was doing it correctly but apparently not. Here is the part of the code that's supposed to handle the mime type conversion.
Map<String, Object> updateProperties = new HashMap<String, Object>();
updateProperties.put("cmis:name", changeName);
updateProperties.put("cmis:contentStreamFileName", changeName);
document.updateProperties(updateProperties);
ContentStream contentStream = document.getContentStream();
InputStream stream = contentStream.getStream();
ContentStream cs1 = session.getObjectFactory().createContentStream(changeName, docLength, MimeTypes.getMIMEType("docx"), stream);
document.setContentStream(cs1, true);
The exact error I am receiving when opening the document in microsoft word is:
"Word cannot open the file because the file format does not match the file extension"
I'm not sure how to change the the actual file format of the document during the update. It appears that this solution is not doing it for me. Not sure if I'm missing something.