在c#或php或.net中将DOC文件转换为DOCX [关闭]

I want to convert DOC file to DOCX in c# or php or .net.

Is it possible?

Have a look over here, definitely possible via the interop methods etc.

But a few alternatives on that page, like the ofc tool.

C# Snippet from that page.

static void Main(string[] args)
{
    Word._Application application = new Word.Application();
    object fileformat = Word.WdSaveFormat.wdFormatXMLDocument;
    DirectoryInfo directory = new DirectoryInfo(@"c:\abc");
    foreach (FileInfo file in directory.GetFiles("*.doc", SearchOption.AllDirectories))
    {
        if (file.Extension.ToLower() == ".doc")
        {
            object filename = file.FullName;
            object newfilename = file.FullName.ToLower().Replace(".doc", ".docx");
            Word._Document document = application.Documents.Open(filename);

            document.Convert();
            document.SaveAs(newfilename, fileformat);
            document.Close();
            document = null;
        }
    }
    application.Quit();
    application = null;
}

For batch-processing documents you could look at creating a managed AddIn for Word. See http://msdn.microsoft.com/en-US/office/hh133430 for more info.