How to close an Excel if it opens by accessing JAVA and APACHE-POI 3.6?

advertisements

We are developing application in JAVA AND using APACHE POI 3.6 for accessing Ms-Excel files. Suppose,my Excel file is opening, when running my program, then it raising the error and program terminated.So, First i want to check that whether my excel is opened or not.If it is opening, then i want to close my excel file and then open and read that file...


POI does not run Excel at all. It is independent code that opens your excel file and interprets the contents. There is no straightforward way for you java code to communicate with Excel and check to see if it is running. You can look into Java/COM bridges for complex mechanisms for trying to coordinate.