public class BatchWordProcessing extends AbstractWordProcessing
try {
BatchWordProcessing bwp = new BatchWordProcessing();
// first document
bwp.createNewDocumentFromTemplate("SampleTemplate");
bwp.typeTextAtBookmark("AddressLine1", "O'Reilly & Associated, Inc.");
bwp.typeTextAtBookmark("AddressLine2", "Mr Miller");
bwp.typeTextAtBookmark("AddressLine3", "101 Moris Street");
bwp.typeTextAtBookmark("AddressLine4", "Sebastopol, CA 95472-9902");
bwp.typeTextAtBookmark("Salutation", "Dear Mr Miller,");
bwp.printAndForget();
// next document
bwp.createNewDocumentFromTemplate("SampleTemplate");
bwp.typeTextAtBookmark("AddressLine1", "Company X");
bwp.typeTextAtBookmark("AddressLine2", "Mister A");
bwp.printAndForget();
// next document
bwp.createNewDocumentFromTemplate("SampleTemplate");
bwp.typeTextAtBookmark("AddressLine1", "Frima Y");
bwp.typeTextAtBookmark("AddressLine2", "Herrn B");
bwp.printAndForget();
// finally
bwp.quitApplicationAfterWaiting(5000);
bwp.exec();
} catch(IOException ioe) {
de.must.io.Logger.getInstance().error(getClass(), ioe);
}
By default, WordAPI.exe will wait 5000 milliseconds after the last command
sent to word (e.g. print) before it tries to quit the word application.
Thus, word terminating problems are avoided. Use higher waiting
intervals if necessary, e.g. quitApplicationAfterWaiting(10000)
dataFolder
Constructor and Description |
---|
BatchWordProcessing()
Creates a batch word processing driver.
|
BatchWordProcessing(java.lang.String inputFileName,
java.lang.String logFileName)
Creates a batch word processing driver.
|
Modifier and Type | Method and Description |
---|---|
protected java.lang.String |
getDriverExecutableName()
Returns the name of the executable to be used.
|
beginWorkingWithTable, beginWorkingWithTable, changeDocumentDirectory, closeDocument, closeWordInput, createNewDocumentFromTemplate, endWorkingWithTable, exec, exec, executeMacro, exportDocumentAsPdf, exportDocumentAsPdfAndClose, finalize, newRow, output, printAndForget, printAndForget, printAndForget, quitApplication, quitApplicationAfterWaiting, saveDocumentAs, saveDocumentAsAndClose, setNoteNotMatchingBookmarks, setPrinterName, typeTextAtBookmark, typeTextAtBookmark
public BatchWordProcessing() throws java.io.IOException
java.io.IOException
public BatchWordProcessing(java.lang.String inputFileName, java.lang.String logFileName) throws java.io.IOException
inputFileName
- the name of the input file to be used by the driverlogFileName
- the name of the log file to be used by the driverjava.io.IOException
protected java.lang.String getDriverExecutableName()
getDriverExecutableName
in class AbstractWordProcessing
Copyright 1998-2023 Christoph Mueller, Kaerntner Str. 56, D-70469 Stuttgart, Germany, https://www.perpus.de