We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Document Is Open?

How can I test whether a document is currently opened by another user?

Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your inquiry. If you would like to know whether document is opened in MS Word then you can try using the following code:

string fileName = @"Test148\in.doc";

//check whether file exists

if (File.Exists(fileName))

{

try

{

//Try to open file

Stream fileStream = File.Open(fileName, FileMode.Open);

}

catch (System.IO.IOException ex)

{

//Code for handling the IOException.

}

catch (Exception ex)

{

//code for handling other exception

}

}

Hope this helps.

Best regards.