none
Convert Office 2003 document to Office 2007 document

    Question

  • Hi All,

    I have a very large bunch of Word, Excel, powerpoint (2003) documents which I would like to convert to their Office 2007 version (i.e. docx, xslx, etc).

    Is there an api I can used to create an application which will convert them automatically?
    If you have example that would be great.

    I think I saw some product out there but need to develop my own one just to do that.

    Cheers.
    Wednesday, January 27, 2010 2:29 PM

Answers

  • Addins used to be the only thing you could do with VSTO.  That is no longer the case.  You can consume and process at the document level with the interop.  In other words you don't have to open up the files in Word to work with a single document at the application level.  You can get an idea of what I am talking about by reviewing the conversion process  from word 2007 to pdf.

    You do have to have office 2007 installed to use the Interop, but other than that your program runs independant of the word user interface application.
    BrianMackey.NET
    Wednesday, January 27, 2010 4:23 PM

All replies

  • Take a look at word 2007 interop.  It has a save feature and I'm sure there's a way to save as word 2007.  For details I suggest asking the vsto forum.
    BrianMackey.NET
    Wednesday, January 27, 2010 2:45 PM
  • Cheers Brian,

    For the tips, the only thing is that the application is not planned to be an addin.

    The thing is that we are planning to upgrade our software from Office 2003 to Office 2010 and from my understand there is no support of office 2003 doc to open in Office 2010.

    Thus, I need to find a way to convert all these documents to Office 2007 format.

    So it cannot be an adding and I think that what you suggested only work as part of a 2007 addin.
    Wednesday, January 27, 2010 3:56 PM
  • Addins used to be the only thing you could do with VSTO.  That is no longer the case.  You can consume and process at the document level with the interop.  In other words you don't have to open up the files in Word to work with a single document at the application level.  You can get an idea of what I am talking about by reviewing the conversion process  from word 2007 to pdf.

    You do have to have office 2007 installed to use the Interop, but other than that your program runs independant of the word user interface application.
    BrianMackey.NET
    Wednesday, January 27, 2010 4:23 PM
  • I'm not sure, who told you that you won't be able to open Office 2003 documents in Office 2010 applications, but this is not correct.

    Here is some code I use for locking Excel workbooks en masse.  You should be able to figure out how to save to the latest version.  I use this in a foreach loop that enumerates over the files from DirectoryInfo.

    Word has a Convert option in the File menu, and I'm sure you can access that from the PIA as well.

    Code Snippet
    1. xls.Application ExcelObj = new xls.Application();
    2. ExcelObj.DisplayAlerts = false;
    3. ExcelObj.Visible = false;
    4. activeWB = (xls.Workbook)ExcelObj.Workbooks.Open(S_Directory + fileName,
    5.     2, false, Type.Missing, "", "",
    6.     true, xls.XlPlatform.xlWindows, "",
    7.     false, false, 0, false, true, 0);
    8.  
    9. xlsformat = activeWB.FileFormat;
    10.  
    11. activeWB.SaveAs(S_Directory + fileName,
    12.     xlsformat, Type.Missing, pwd, true,
    13.     false, xls.XlSaveAsAccessMode.xlNoChange,
    14.     Type.Missing, Type.Missing, Type.Missing, Type.Missing,
    15.     Type.Missing);
    Wednesday, January 27, 2010 11:07 PM
  • I am interested to know where Chris Fo gets his information regarding Office 2010 support for Office 2000 files.  The best information I can find is on the Office 2010 beta page:

    Can I open previous versions of Microsoft Office files in Office 2010?

    Yes, files created in previous versions of Microsoft Office can be opened using the Office 2010 version of the applications. Supported files vary by product.
    I recommend you download the beta for office 2010 and let us know if it lets you open office 2000 files (though from the description it seems to be hit or miss).
    Officially, Office 2000 support stopped as of July 14, 2009 and so it makes sense that Office 2k support died in Windows 7.

    BrianMackey.NET
    Thursday, January 28, 2010 12:24 AM
  • I didn't say anything about Office 2000, but I would assume that it's doable.  I don't have a copy of Office 2000 around to test, but his question pertained to Office 2003.  Unless I completely misunderstood his constant use of Office 2003 to indicate he wanted to convert from Office 2000 to Office 2010.
    Thursday, January 28, 2010 1:29 AM
  • Ive got no idea how i got sidetracked on office 2k. My bad
    BrianMackey.NET
    Thursday, January 28, 2010 3:09 AM