Free Support Forum - aspose.com

OutputStream and saving document to a database

Hi ,

I'm evaluating Aspose.Words for Java

I am having problems doing the following

I successfully do a mailmerge.

I then pass a ByteArrayOutputStream to document.save(OutputStream,SaveFormat.DOC);

I then create a ByteArrayInputStream object and pass it the byte array from my ByteArrayOutputStream object

I then save the InputStream to a Blob column in a database. This all "works". I have previously working code that on a jsp when clicking a link the database is accessed , the blob is converted to a byte array, the mime type is set and Word is opened displaying the document.

My problem is that the encoding appears to be all screwed up when I try to access the mail-merged document.

I get the following message in word:"Select the encoding that makes the document readable."

Any ideas on how to resolve this? Am I doing something incorrectly?

Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />


Afraid, I do not properly understand your question. DOC format is binary and doesn’t depend on encoding on its own.

Anyway you have to divide Aspose’s, database’s, jsp’s and other APIs if you want to localize the error.

First of all, please try just to save your document to a file. If the file can be opened by MS Word than Aspose.Words doing well.

Best Regards,