I have the following code:
DocumentTemplate doc = adminService.getDocumentById(params.id?.toLong())
byte[] responseData = adminService.convertDocxBytesToModel(doc.contentType, doc.data);
String myContentType = doc.getContentType()
println "myContentType: " + myContentType
int myContentSize = responseData.size()
println "myContentSize: " + myContentSize
response.contentType = myContentType
response.contentLength = myContentSize
response.outputStream << responseData
and
myContentSize shows as 45758
myContentType is reported as "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
The file downloads as a *.docx file, but something is not right with it. If I open the file in Word and save-as, it’s fine. But without doing the save-as step, it’s not a valid word (xml) file.
Is there something else I need to set besides the content type? And is that content type wrong?
Thanks for any help,
Andy