none
Saving Word document RRS feed

  • Question

  • I would like to save a Word document according to the Word installed version;

    In case it is Word 2003 (appropriate version number is 11), with DOC extension.
    In case the Word version is higer than 2003, with DOCX extension.

    The difference is reflected in the second argument sent to the SaveAS method:

    object fileFormat = GraphDocsSettings.Default.WordInstalledVersion > 11.0?     
                    WdSaveFormat.wdFormatXMLDocument : WdSaveFormat.wdFormatDocument;
    
    wordDoc.SaveAs(ref outputFile, fileFormat, ref missing, ref missing, ref missing,
                               ref missing, ref missing, ref missing, ref missing,
                               ref missing, ref missing, ref missing, ref missing,
                               ref missing, ref missing, ref missing);  

    However, When using Interop.Word 11.0 I get the following error:

    Microsoft.Office.Interop.Word.WDSaveFormat does not contain a definition for wdFormatXMLDocument.  

    Any ideas?

    Wednesday, April 23, 2014 9:19 AM

All replies