Free Support Forum - aspose.com

Document as Byte[]

Is it possible to return com.aspose.words.Document as a byte[], directly, rather than have to convert to string/text and using String.getByte()? If you call Document.getText() or Document.toTxt() the resulting String does not retain Word's custom objects like tables, charts, etc.

Please advise,

Thank you.

Found the path:

java.io.ByteArrayOutputStream baos = new ByteArrayOutputStream();

com.aspose.words.Document theDoc = new Document();

theDoc.getMailMerge().execute(rs);

theDoc.save(baos, SaveFormat.DOC);

baos.toByteArray();

Hi

It is very nice that you found solution independently.

Best regards.