We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Generated DOCX/XPS documents are corrupted or causes problems

We have problems with generated docx or xps files using the Aspose.Words 9.2 evaluation version.

Our process:

loading a document tamplate (e.g doc or docx file)

mailmerge some fields

save the document in a memory or file stream in different output formats: doc, pdf, docx, xps

The generated docx or xps files causes problems. Office 2010 shows a dialog, that the document is corrupted or the contant causes problems.

Attached you will find the generated docx-file.

i hope you can help an have a solution.

code example:

// Get Document Template

Aspose.Words.Document doc = new Aspose.Words.Document(docTemplate.GetFile());


// MailMerge for all fields



SaveFormat docFormat = (SaveFormat)Enum.Parse(typeof (Aspose.Words.SaveFormat), fileType, true);

// copy document into transfer structure

MemoryStream memStream = new MemoryStream();

doc.Save(memStream, docFormat);

// ... save document in database or filesystem


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

Thanks for your inquiry. I suppose, the problem occurs when you save document in database or filesystem. As I can see at the end of the file where are 8861 additional zero-bytes. If remove these additional zero-bytes, the document can be successfully opened by MS Word.

Please check your code. Also, you can attach your code here and I will check it.

The following article might be useful for you:


Best regards,