Process.Start is hanging with Word 2007

Hi,

I’m not sure what is going on, but when I call Process.Start with a file created and saved with Aspose.Words, the system just hangs on that line of code for quite awhile before actually launching Word with the new document.

Do you have any clues as to what might cause this behavior? It is happening with both Word 2007 and Word 2003.

Thanks

Hi

Thanks for your request. Have you tried just opening the generated file using MS Word? Could you please attach this document here for testing and provide me your code?

Best regards.

It appears to be a sharing violation, which I tracked down using ProcMon. How can I ensure that Aspose.Words relinquishes the file after calling Document.Save ?

Hi

Thanks for your request. Process.Start works fine on my side. Here is my code:

//Save document
string fileName = @"Test137\out.doc";
doc.Save(fileName);
//Open document in MS Word
Process.Start(fileName);

You can also try using the following code.

//Save document
string fileName = @"Test137\out.doc";
using (FileStream file = File.OpenWrite(fileName))
{
    doc.Save(file, SaveFormat.Doc);
}

//Open document in MS Word
Process.Start(fileName);

Best regards.