0

If user is writing in a word file(eg: abc.docx) and he finishes working and closes this file, I want to get its status that abc.docx is been close is there any way to find out using java i am just passing the path of the docx file

File file = new File("abc.docx");
                    log.info("file {} exits {}",file,file.exists());

i want to get the status either file is opened or closed

swaheed
  • 3,671
  • 10
  • 42
  • 103
  • Possible duplicate of [Check if file is already open](https://stackoverflow.com/questions/1390592/check-if-file-is-already-open) – Kepotx Apr 16 '18 at 15:00
  • Can you post some code that you have tried? – Sid Apr 16 '18 at 15:00
  • i have added the code also the link given above does not work for me – swaheed Apr 16 '18 at 19:50
  • I don't know if this will help, but... When I file is open in Word, Word creates a "temp" file in the same folder where that file is saved. When the file is closed (normally, not through a crash) the temp file is removed. A temp file begins with a tilde ( ~ ) plus dollar sign ( $ ). For example, `~$tiveX_ComboBox.docm` is the temp file for `ActiveX_ComboBox.docm`. Theoretically, you could check for the presence of such a file before and immediately after opening a document and, when it disappears again, the file is closed. Or can Java monitor events in the Word application? – Cindy Meister Apr 17 '18 at 14:59

0 Answers0