This project has moved. For the latest updates, please go here.

docx corruption

Sep 14, 2012 at 1:37 AM

Hi,

I am using the docx syntax as follows:

using (DocX document = DocX.Load(ToFile))
{

document.ReplaceText("[[company]]", strcompany, false, RegexOptions.IgnoreCase, null, null, MatchFormattingOptions.ExactMatch);

document.Save();
}

It loads a document, replaces text and saves the document. I later on download the document.

When it opens the document, it returns an error message "The file xxx.docx cannot be opened because there are problems with the contents" then "Word found unreadable content in xxx.docx. Do you want to recover the contents of this document? If you trust the source of this document, click Yes."

The document loads fine.

I have traced the problem to the line document.Save(). If this line is commented out, it does not re-save the file and i no longer get an error message.

Has anyone experienced this?

Sep 20, 2012 at 12:45 AM

Can anyone help with this?