Reputation: 253
I've successfully implemented OpenXML that takes the bookmarks within a document and replaces them. Unfortunately it only works with .docx and from what I understand .doc is not compatible with the OpenXML format.
So, what I'm wondering is if I can take that WordprocessingDocument
and convert it to a .doc when users try and download it. Is that possible? If so anyone know how to do that?
Upvotes: 0
Views: 1929
Reputation: 28320
Converting from DOCX to DOC with Open XML SDK 2.0 is not possible.
Upvotes: 1
Reputation: 5112
Either use a third party library, like Aspose.Words. Or you need to use Microsoft Interop services.
This is sample C# code:
Microsoft.Office.Interop.Word.Application wordApplication = new Microsoft.Office.Interop.Word.Application();
Microsoft.Office.Interop.Word.Document wordDocument = wordApplication.Documents.Open(opath);
wordDocument.SaveAs("BLUH.DOC", WdSaveFormat.wdFormatDocument);
((Microsoft.Office.Interop.Word._Document)wordDocument).Close(); // cast necessary
((Microsoft.Office.Interop.Word._Application)wordApplication).Quit(); // cast necessary
Take a look at these pages:
Upvotes: 0