DOCX prompt on saving file created in .Net

Hey everyone!

I am creating a docx file and it looks and prints fine but when trying to save the file I get a prompt.

“Your document will be upgraded to the newest file format”

How do I keep this from coming up? I am using the version 25.10.0.0 and below is my code for creating the document. Thanks for any help you can provide me!

  Dim doc As New Document()
  lbPacketReport.GeneratePacketCover(doc, pktData)

  Using memStream As New MemoryStream()

      My.Response.ContentType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
      My.Response.AddHeader("content-disposition", "attachment;  filename=coverpage.docx")
      My.Response.Charset = "UTF-8"

      doc.Save(memStream, SaveFormat.Docx)

      memStream.WriteTo(My.Response.OutputStream)
      My.Response.Flush()
      My.Response.End()
  End Using

@bydavis

Summary
When the DOCX generated by Aspose.Words is opened in Microsoft Word, Word may display the dialog “Your document will be upgraded to the newest file format.” This occurs because the file is saved in an older compatibility mode. Setting the document’s compatibility to the latest Word version before saving removes the prompt.

Why it happens

  • A new Document() is created with the default compatibility (Word 2007).
  • Word detects that the file is in an older compatibility mode and offers to upgrade it to the current format (e.g., Word 2016/2019).
  • The dialog is generated by Word itself; changing HTTP headers or the Save call alone does not affect it.

What to do next

  1. Target the newest compatibility mode before saving the document.
Imports Aspose.Words
' Aspose.Words.Saving is optional; it contains SaveOptions classes if needed.

Dim doc As New Document()
' … build the document …

' Set the document to the latest Word version (e.g., Word 2019)
doc.CompatibilityOptions.OptimizeFor(CompatibilityMode.Word2019)
' Optional: disable legacy formatting if it is not required
doc.CompatibilityOptions.UseLegacyFormatting = False

Using memStream As New MemoryStream()
HttpContext.Current.Response.ContentType = _
"application/vnd.openxmlformats-officedocument.wordprocessingml.document"
HttpContext.Current.Response.AddHeader("content-disposition", _
"attachment; filename=coverpage.docx")
HttpContext.Current.Response.Charset = "UTF-8"

doc.Save(memStream, SaveFormat.Docx)
memStream.WriteTo(HttpContext.Current.Response.OutputStream)
HttpContext.Current.Response.Flush()
HttpContext.Current.Response.End()
End Using
  1. Validate the output – download the file and open it in Word. The upgrade dialog should no longer appear.

  2. Check for legacy features if the prompt persists. Elements such as older table styles, VML drawings, or other compatibility‑mode‑triggering features can force Word to keep the document in an older mode. Removing or updating those elements will also prevent the dialog.

Note: The upgrade dialog is a client‑side behavior of Microsoft Word. Aspose.Words can only prevent it by ensuring the document is saved in the latest compatibility mode; it cannot suppress the dialog after the file has been created.

:warning: I could not fully verify this explanation against the retrieved sources. Please double-check the behaviour in your environment and confirm the exact SDK/version.

1 Like

Thank you so much for the quick detailed response! I have tried this before but CompatibilityMode.Word2019 does not appear to be available for me. it has a red squiggly under it.

@bydavis Most likely you are using some very old version of Aspose.Words. OptimizeFor method has been added a long ago. So, please try using the latest version of Aspose.Words.

1 Like

Hey thanks I figured it out… was conflicting with my devexpress library. Thanks again for all your help!

1 Like