在java中用windows的功能可以试试jacob,比如操作word:// open a MS Word doc and get its handler
ActiveXComponent word = new ActiveXComponent("Word.Application");
word.setProperty("Visible", new Variant(false));
word.setProperty("DisplayAlerts", new Variant(false));
Dispatch docs = word.getProperty("Documents").toDispatch();
// open word file
Dispatch doc = Dispatch.invoke(docs, "Open", Dispatch.Method, new Object[]{inputPath, new  Variant(false), new Variant(true)}, new int[1]).toDispatch();
// set docuPrinter instance as printer and print document content into it
word.setProperty("ActivePrinter", new Variant("docuPrinter")); //"docuPrinter"是另一个ActiveXComponent实例
Dispatch.call(doc, "PrintOut");
// check if output file has been successfully created, if not, wait 1 sec, loop until time out
int timeout = 15; // unit is sec
File tmpFile = new File(outputFolder+"/"+outputFileName);
while (!tmpFile.exists() && timeout-- >= 0) {
logger.debug("File :"+tmpFile.getPath()+" has not yet been created, wait 1 sec.");
Thread.sleep(1000);
}
// do not open Word window
Dispatch.call(doc, "Close", new Variant(true));
Dispatch.call(word, "Quit");