Free Support Forum -

Can't open a document with content controls (e.g. RTF box for user to enter data)

I have some Word templates that have some merge fields (which work fine in the .DOC version of the file).

Some of these need to have content controls (e.g. RTF text boxes and date pickers) for people to enter text that varies from document to document. However, this requires the document to be a .DOCX version of Word. When I do that and try to run the code I have, then I get an error.

A little background to setup. I have a VB.NET DLL called from a web page code behind (.cs), and the VB DLL uses the ASPOSE DLL to do the mailmerge.

I have tried the Beta 4.4.3, but that is the same as the version I had before.

This is what I get:

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

The stack trace gives:

[NullReferenceException: Object reference not set to an instance of an object.]
   ⎜.⎛.⎳(String ⍥) +13
   ⎜.⑽.ഽ(⎛ ⑺, ࣼ ᠪ, ࡯ ⑾) +2201
   ⎜.⑼.ഽ(⎛ ⑺) +72
   ⎜.⑹.⑻(⎛ ⑺, CompositeNode ↫) +189
   ⎜.┐.ഽ(⎛ ⑺) +113
   ⎜.⎛.⎨() +83
   Aspose.Words.Document.ࠈ(Stream ؟, LoadFormat ࠉ, String ׾) +399

[FileCorruptedException: The document appears to be corrupted and cannot be loaded.]
Aspose.Words.Document.ࠊ(Exception ࠋ) +70
Aspose.Words.Document.ࠈ(Stream ؟, LoadFormat ࠉ, String ׾) +742
Aspose.Words.Document…ctor(String fileName, LoadFormat loadFormat, String password) +220
Aspose.Words.Document…ctor(String fileName) +9
MailMerge.clsReport…ctor(DataTable& oTable, String sTemplate, String sOutputFileName) in C:\MailMergeDLL with ASPOSE\TestDLL\TestDLL\clsReport.vb:614
_2_edit_comm.GenerateDocFromTemplate(String sTemplateFilename) in c:\web\in161_Fire_Defence_for_Steve\net\2_edit_comm.aspx.cs:4194
_2_edit_comm.CreateDocFromTemplateListGrid(String sDocTemplateId) in c:\web\in161_Fire_Defence_for_Steve\net\2_edit_comm.aspx.cs:1211
_2_edit_comm.ProcessEvents() in c:\web\in161_Fire_Defence_for_Steve\net\2_edit_comm.aspx.cs:187
_2_edit_comm.Page_Load(Object sender, EventArgs e) in c:\web\in161_Fire_Defence_for_Steve\net\2_edit_comm.aspx.cs:69
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +33
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1436

Is this expected currently - i.e. should I not be using content controls?


Thanks for your inquiry. Could you please attach your document for testing? (only you and Aspose staff members can download it). I will investigate this problem and provide you more information.

Best regards.

Sure - if I have the hang of it :-)

I've changed the extension from DOCX to TXT as requested




Thank you for additional information. I managed to reproduce this problem. I have created new issue #4372 in our defect database. Please expect a reply before the next hotfix (within 2-3 weeks).

Best regards.

We have released a new version of Aspose.Words that contains a fix for this issue.

Issue #4372 - “Aspose.Words.FileCorruptedException” exception occurs during opening DOCX document.

Full support for Content Controls will be available later, hopefully in March

The new version of Aspose.Words is available for download from here.

Best regards.