Using Aspose.Words 5.2.2.0 for .NET, I have a .docx word document that fills in the users’ name into a bookmark, then launches on the client machine. Upon clicking the link to open the document, one user gets the following prompt:
“The file was created by a newer version of Microsoft Office Word and a converter is needed to open it. Do you want to download the converter from the Microsoft Office Web Site?”
If he clicks “Yes”, he is sent to the link below, which is not a valid page:
http://support.microsoft.com/smarterror/default.aspx?spid=global&query=kb%20967950&errurl=%2fdefault.aspx%2fkb%2f967950
If he clicks “No”, the file opens just fine and his name is populated on the form. He has both Office 2007 and 2003 on his machine and the .docx and .doc file types are set to open with Office 2007. When typing in the path of the source Word document, not using Aspose to pre-fill the bookmark, the blank document opens in Word 2007 without issues. The user’s operating system is XP Professional Service Pack 2. The operating system on the web server is Microsoft® Windows® Server 2003, Enterprise Edition, Version 5.2.3790 Service Pack 2 Build 3790. No other users have reported the same issue. Attached is a copy of the Word document and below is code to generate the document:
wl.SetLicense(Server.MapPath(".") + "\\Aspose.Custom.lic.xml");
MemoryStream strmDoc;
strmDoc = GetDocStream("path to my doc here");
Document doc = new Document(strmDoc);
DocumentBuilder docbld;
Document docReturn = new Document();
docReturn.RemoveAllChildren();
docbld = new DocumentBuilder();
docbld.Document = doc.Clone();
Aspose.Words.Bookmark bookmark = docbld.Document.Range.Bookmarks["NAME"];
if (bookmark != null)
{
docbld.MoveToBookmark("NAME", false, true);
docbld.Write("User Name Here");
}
foreach (Aspose.Words.Section srcSection in docbld.Document)
{
Node dstSection = docReturn.ImportNode(srcSection, true, ImportFormatMode.KeepSourceFormatting);
docReturn.AppendChild(dstSection);
for (int i = 0; i < docReturn.Sections.Count; i++)
{
docReturn.Sections[i].HeadersFooters.LinkToPrevious(false);
}
}
docbld = null;
docReturn.Protect(ProtectionType.ReadOnly, "passwordGoesHere");
docReturn.Save("MyDoc.docx", SaveFormat.Docx, Aspose.Words.SaveType.OpenInWord, Response);
Response.End();