用java-com在java调word你看下吧private boolean printToWord(int clientID, String filename, String uncName, 
String frontPageTray, String defaultTray) {
ActiveXComponent com;

try {
com=new ActiveXComponent("Word.Application");
com.setProperty("Visible", new Variant(false));

// OLE: set the default printer
if (uncName!=null && uncName.length()>0) {
com.setProperty("ActivePrinter", new Variant(uncName));
writeLog(out, clientID+" Word set active printer to:  "+uncName);
} Object documents=com.getProperty("Documents").toDispatch();
Dispatch.call(documents,"Open",filename);
writeLog(out, clientID+" client's file has been opened:  "+filename); // PrinterTrays
int lvFrontPageTray=0;
int lvDefaultTray=0;

if (frontPageTray!=null && frontPageTray.length()>0) {
lvFrontPageTray=Integer.parseInt(frontPageTray);
}

if (defaultTray!=null && defaultTray.length()>0) {
lvDefaultTray=Integer.parseInt(defaultTray);
}

Object ActiveDoc = com.getProperty("ActiveDocument").toDispatch();
Object PageSetup = Dispatch.get(ActiveDoc, "PageSetup").toDispatch();

Dispatch.put(PageSetup, "FirstPageTray", new Variant(lvFrontPageTray));
writeLog(out, clientID+" Word set FirstPageTray to:  "+lvFrontPageTray);

Dispatch.put(PageSetup, "OtherPagesTray", new Variant(lvDefaultTray));
writeLog(out, clientID+" Word set OtherPagesTray to:  "+lvDefaultTray);
com.invoke("PrintOut", new Variant[] {new Variant(false)});
writeLog(out, clientID+" client's file has sent to the printer"); Dispatch.call(ActiveDoc, "Save");
writeLog(out, clientID+" client's file has been saved.");

// Quite Microsoft Word
com.invoke("Quit", new Variant[] {});
writeLog(out, clientID+" client's word application has requested to quit");
} catch (Throwable e) {
writeLog(out, clientID+" client has error in printing the word document: "+e.getMessage());
e.printStackTrace();
return false;


return true;
}