Home > other >  Jacob PPT error operation
Jacob PPT error operation

Time:10-11



Business code would only write four years of development, the distributed high concurrency also can't be a programmer? ->>


Private Boolean ppt2PDF (String inputFile, String pdfFile) {
ComThread. InitSTA ();

Long start=System. CurrentTimeMillis ();
ActiveXComponent app=null;
Dispatch PPT=null;
Try {
App=new ActiveXComponent (" PowerPoint. Application ");//create a PPT object
//app. SetProperty (" Visible ", new Variant (true));//not visible open (PPT conversion is not running hidden, so here are commented out)
//app. SetProperty (" AutomationSecurity ", new Variant (3));//disable macros
Dispatch PPTS=app. GetProperty (" Presentations ".) toDispatch ();//it attributes to obtain files

System. Out.println (" open the document & gt;> "+ inputFile);
//call the Documents in the object, the Open method to Open the Document and return to Open the Document object Document
PPT=Dispatch. Call (PPTS, "Open", inputFile,
True,//ReadOnly
True,//if there is a title of a specified file Untitled
False//WithWindow whether the specified file is
). ToDispatch ();

System. Out.println (" conversion document [" + inputFile + "] & gt;> [" + pdfFile + "] ");
Dispatch. Call (PPT, SaveCopyAs, pdfFile, ppFormatPDF);
//Dispatch. Call (PPT, "ExportAsFixedFormat pdfFile, ppFormatPDF);
Long end=System. CurrentTimeMillis ();

System. Out. Println (" is: "+ (end - start)," Ms. ");

return true;
} the catch (Exception e) {
e.printStackTrace();
System. The out. Println ("========Error: document conversion failure: "+ um participant etMessage ());
} the finally {
Dispatch. Call (PPT, "Close");
System. The out. Println (" close the document ");
If (app!=null)
App. Invoke (" Quit ", new Variant [] {});
}
ComThread. Release ();
ComThread. QuitMainSTA ();
return false;
}
This code is circulated online, PPT turn PDF is complains
Com.jacob.com.ComFailException: Invoke of: SaveAs Source: 2013 Description: Microsoft PowerPoint Presentation. The SaveAs: PowerPoint to cannot save ^ 0 ^ 1,
PPT turn JPG is such a mistake, but not a word and excel, solving ah,,,
Or what other Windows office turn PDF method (even though it's v?
Grateful,

CodePudding user response:

I also encountered this problem, a great god solved?
  • Related