I use JACOB to make COM calls for PowerPoint and other Office applications with Java. In a separate Windows 7 window, I get the following message quite often, but not always:
Source: Microsoft Office PowerPoint 2007 Description: PowerPoint could not open the file.
From excel, I get:
ERROR - Invoke of: Open Source: Microsoft Office Excel Description: Microsoft Office Excel cannot access the file 'c:\marchena\marchena10\work\marchena\batch_58288\input\content_1.xlsx'. There are several possible reasons: ? The file name or path does not exist. ? The file is being used by another program. ? The workbook you are trying to save has the same name as a currently open workbook.
Word Error:
VariantChangeType failed
The following is what I run, the error comes from the last line.
ComThread.InitSTA(); slideApp = new ActiveXComponent("PowerPoint.Application"); Dispatch presentations = slideApp.getProperty("Presentations").toDispatch(); Dispatch presentation = Dispatch.call(presentations, "Open", inputFile.getAbsolutePath(), MsoTriState.msoTrue.getInteger(),
I tried to set a breakpoint just before making an open call, and there is a file, and I can open it using PowerPoint in the GUI, but when I take a step, this is an exception.
The unfortunate thing about this problem is that it seems to always start from the very beginning, but after it scrambled for a while (repeating the same code), it ultimately succeeds, and after that never repeated.
Further research I found that this only happens with .ppt, .doc and .xls files, not .pptx, .docx and .xlsx. And as far as I can tell, this is not related to the file system (I changed the mechanism that copies the files and tries to put the files in another file system).
I just noticed that this only happens when the Java application is running as a service, and not when I run catalina.bat start from the command line.
java ms-office powerpoint com jacob
Sindri traustason
source share