| java.lang.Object com.salmonllc.mailmerge.MailMerge
MailMerge | public class MailMerge implements Runnable(Code) | | Mail Merge for Winword on Server
Requirements:
Need Winword installed on server.
Need the following properties in properties file, preferably system.properties
WinWordPath=d:\\Microsoft Office\\Office
WinWordTemplatePath=d:\\Microsoft Office\\Templates
WinWordPath is the Path to winword.exe
WinWordTemplatePath is the Path to the location of Salmon.dot which is required to be deployed to the server.
Deploy Salmon.dot file to the directory specified by WinWordTemplatePath property.
Use mailMergePrint to print the mail merged document on the server printer.
Use mailMergePrintToFile to print the mail merged document to a file, useful for generating PDF's see below.
Use mailMergeSaveAs to save the mail merged document to a doc file, which can be sent back to a browser for client side printing.
If you want to print to pdf, you must have Acrobat installed on the server and setup as the default printer and use
mailMergePrintToFile method to generate the PDF which can be sent back to a browser for client side printing.
Creation date: (1/11/02 2:53:36 PM)
author: : Fred Cahill |
Constructor Summary | |
public | MailMerge() Creates a MailMerge object. |
Method Summary | |
public void | addOLEFileField(String sField, File fOLEFile) Specifies an OLE File to be inserted at a field location in a word template.
Creation date: (3/15/02 10:44:02 AM)
Parameters: sField - java.lang.String Name of a field in a word template file Parameters: fOleFile - java.io.File A File object pointing to a OLE File. | public void | addPictureField(String sField, File fPicture) Specifies a Picture File to be inserted at a field location in a word template.
Creation date: (3/15/02 10:44:02 AM)
Parameters: sField - java.lang.String Name of a field in a word template file Parameters: fPicture - java.io.File A File object pointing to a Picture File. | public void | addSimpleFileField(String sField, File fSimpleFile) Specifies a Simple File to be inserted at a field location in a word template.
Creation date: (3/15/02 10:44:02 AM)
Parameters: sField - java.lang.String Name of a field in a word template file Parameters: fSimpleFile - java.io.File A File object pointing to a Simple File. | public void | addTextField(String sField, String sText) Specifies text to be inserted at a field location in a word template. | public static void | concatFilesPrint(String sFile1, String sFile2) Concatenates two word files and prints the result. | public static void | concatFilesPrintToFile(String sFile1, String sFile2, String sPrintFileName) Concatenates two word files and prints the result to a file. | public static void | concatFilesSaveAs(String sFile1, String sFile2, String sSaveAsFileName) Concatenates two word files and saves the result to a file. | public static void | mailMergePrint(String sTemplateFileName, String sDataSourceFileName) Mail Merges a template file with the values in DataSource File and prints the result. | public static void | mailMergePrint(String sTemplateFileName, String sDataSourceFileName, Hashtable htFields) Mail Merges a template file with the values in DataSource File and a Hashtable and prints the result. | public static void | mailMergePrint(String sTemplateFileName, Hashtable htFields) Mail Merges a template file with the values in the Hastable and prints the result. | public static void | mailMergePrintToFile(String sTemplateFileName, String sDataSourceFileName, String sPrintFileName) Mail Merges a template file with the values in DataSource File and prints the result to a file. | public static void | mailMergePrintToFile(String sTemplateFileName, String sDataSourceFileName, String sPrintFileName, Hashtable htFields) Mail Merges a template file with the values in DataSource File and Hashtable and prints the result to a file. | public static void | mailMergePrintToFile(String sTemplateFileName, String sPrintFileName, Hashtable htFields) Mail Merges a template file with the values in the Hastable and prints the result to a file. | public static void | mailMergeSaveAs(String sTemplateFileName, String sDataSourceFileName, String sSaveAsFileName) Mail Merges a template file with the values in DataSource File and saves the result to a file. | public static void | mailMergeSaveAs(String sTemplateFileName, String sDataSourceFileName, String sSaveAsFileName, Hashtable htFields) Mail Merges a template file with the values in DataSource File and Hashtable and saves the result to a file. | public static void | mailMergeSaveAs(String sTemplateFileName, String sSaveAsFileName, Hashtable htFields) Mail Merges a template file with the values in the Hastable and saves the result to a file. | public void | print(String sTemplateFileName, String sDataSourceFileName) Prints a Template File after Mail Merging with a Datasource. | public void | printToFile(String sTemplateFileName, String sDataSourceFileName, String sPrintFileName) Prints to a File a Template File after Mail Merging with a Datasource. | public void | run() | public void | saveAs(String sTemplateFileName, String sDataSourceFileName, String sSaveAsFileName) Saves to a File a Template File after Mail Merging with a Datasource. | public void | setAutoPrint(boolean bAutoPrint) Indicates that if the document is view that it should auto print. | public void | setBackground(File fBackground) Sets the Background of a Word Document. | public void | setBottomMargin(float fBottomMargin) Sets the Bottom Margin of a Word Document. | public void | setFooterDistance(float fFooterDistance) Sets the Footer Distance of a Word Document. | public void | setGutter(float fGutter) Sets the Gutter of a Word Document. | public void | setHeaderDistance(float fHeaderDistance) Sets the Header Distance of a Word Document. | public void | setLeftMargin(float fLeftMargin) Sets the Left Margin of a Word Document. | public void | setPrinter(String sPrinter) Sets the Printer for a Word Document. | public void | setRightMargin(float fRightMargin) Sets the Right Margin of a Word Document. | public void | setTopMargin(float fTopMargin) Sets the Top Margin of a Word Document. |
MailMerge | public MailMerge()(Code) | | Creates a MailMerge object.
Creation date: (3/15/02 10:44:02 AM)
|
addOLEFileField | public void addOLEFileField(String sField, File fOLEFile) throws MailMergeException(Code) | | Specifies an OLE File to be inserted at a field location in a word template.
Creation date: (3/15/02 10:44:02 AM)
Parameters: sField - java.lang.String Name of a field in a word template file Parameters: fOleFile - java.io.File A File object pointing to a OLE File. Examples are .xls,.doc,.ppt |
addPictureField | public void addPictureField(String sField, File fPicture) throws MailMergeException(Code) | | Specifies a Picture File to be inserted at a field location in a word template.
Creation date: (3/15/02 10:44:02 AM)
Parameters: sField - java.lang.String Name of a field in a word template file Parameters: fPicture - java.io.File A File object pointing to a Picture File. Examples are .bmp,.gif,.jpg |
addSimpleFileField | public void addSimpleFileField(String sField, File fSimpleFile) throws MailMergeException(Code) | | Specifies a Simple File to be inserted at a field location in a word template.
Creation date: (3/15/02 10:44:02 AM)
Parameters: sField - java.lang.String Name of a field in a word template file Parameters: fSimpleFile - java.io.File A File object pointing to a Simple File. Examples are .txt |
addTextField | public void addTextField(String sField, String sText)(Code) | | Specifies text to be inserted at a field location in a word template.
Creation date: (3/15/02 10:44:02 AM)
Parameters: sField - java.lang.String Name of a field in a word template file Parameters: sText - java.lang.String The text to be inserted |
concatFilesPrint | public static void concatFilesPrint(String sFile1, String sFile2) throws MailMergeException(Code) | | Concatenates two word files and prints the result.
Creation date: (3/15/02 10:44:02 AM)
Parameters: sFile1 - String Primary word document Parameters: sFile2 - String Document to append to primary one. |
concatFilesPrintToFile | public static void concatFilesPrintToFile(String sFile1, String sFile2, String sPrintFileName) throws MailMergeException(Code) | | Concatenates two word files and prints the result to a file.
Creation date: (3/15/02 10:44:02 AM)
Parameters: sFile1 - String Primary word document Parameters: sFile2 - String Document to append to primary one. Parameters: sPrintFileName - String Name of the generated print file. |
concatFilesSaveAs | public static void concatFilesSaveAs(String sFile1, String sFile2, String sSaveAsFileName) throws MailMergeException(Code) | | Concatenates two word files and saves the result to a file.
Creation date: (3/15/02 10:44:02 AM)
Parameters: sFile1 - String Primary word document Parameters: sFile2 - String Document to append to primary one. Parameters: sSaveAs - String Name of the generated file. |
mailMergePrint | public static void mailMergePrint(String sTemplateFileName, String sDataSourceFileName) throws MailMergeException(Code) | | Mail Merges a template file with the values in DataSource File and prints the result.
Creation date: (3/15/02 10:44:02 AM)
Parameters: sTemplateFileName - java.lang.String Name of a word template file Parameters: sDataSourceFileName - java.lang.String Name of a DataSoure File usually a .csv file. |
mailMergePrint | public static void mailMergePrint(String sTemplateFileName, String sDataSourceFileName, Hashtable htFields) throws MailMergeException(Code) | | Mail Merges a template file with the values in DataSource File and a Hashtable and prints the result.
Creation date: (3/15/02 10:44:02 AM)
Parameters: sTemplateFileName - java.lang.String Name of a word template file Parameters: sDataSourceFileName - java.lang.String Name of a DataSoure File usually a .csv file. Parameters: htFields - java.util.Hashtable A hashtable of field names & values to be used to populate template. |
mailMergePrint | public static void mailMergePrint(String sTemplateFileName, Hashtable htFields) throws MailMergeException(Code) | | Mail Merges a template file with the values in the Hastable and prints the result.
Creation date: (3/15/02 10:44:02 AM)
Parameters: sTemplateFileName - java.lang.String Name of a word template file Parameters: htFields - java.util.Hashtable A hashtable of field names & values to be used to populate template. |
mailMergePrintToFile | public static void mailMergePrintToFile(String sTemplateFileName, String sDataSourceFileName, String sPrintFileName) throws MailMergeException(Code) | | Mail Merges a template file with the values in DataSource File and prints the result to a file.
Creation date: (3/15/02 10:44:02 AM)
Parameters: sTemplateFileName - java.lang.String Name of a word template file Parameters: sDataSourceFileName - java.lang.String Name of a DataSoure File usually a .csv file. Parameters: sPrintFileName - java.lang.String Name of the printed file output |
mailMergePrintToFile | public static void mailMergePrintToFile(String sTemplateFileName, String sDataSourceFileName, String sPrintFileName, Hashtable htFields) throws MailMergeException(Code) | | Mail Merges a template file with the values in DataSource File and Hashtable and prints the result to a file.
Creation date: (3/15/02 10:44:02 AM)
Parameters: sTemplateFileName - java.lang.String Name of a word template file Parameters: sDataSourceFileName - java.lang.String Name of a DataSoure File usually a .csv file. Parameters: sPrintFileName - java.lang.String Name of the printed file output Parameters: htFields - java.util.Hashtable A hashtable of field names & values to be used to populate template. |
mailMergePrintToFile | public static void mailMergePrintToFile(String sTemplateFileName, String sPrintFileName, Hashtable htFields) throws MailMergeException(Code) | | Mail Merges a template file with the values in the Hastable and prints the result to a file.
Creation date: (3/15/02 10:44:02 AM)
Parameters: sTemplateFileName - java.lang.String Name of a word template file Parameters: sPrintFileName - java.lang.String Name of the printed file output Parameters: htFields - java.util.Hashtable A hashtable of field names & values to be used to populate template. |
mailMergeSaveAs | public static void mailMergeSaveAs(String sTemplateFileName, String sDataSourceFileName, String sSaveAsFileName) throws MailMergeException(Code) | | Mail Merges a template file with the values in DataSource File and saves the result to a file.
Creation date: (3/15/02 10:44:02 AM)
Parameters: sTemplateFileName - java.lang.String Name of a word template file Parameters: sDataSourceFileName - java.lang.String Name of a DataSoure File usually a .csv file. Parameters: sSaveAsFileName - java.lang.String Name of the saved file |
mailMergeSaveAs | public static void mailMergeSaveAs(String sTemplateFileName, String sDataSourceFileName, String sSaveAsFileName, Hashtable htFields) throws MailMergeException(Code) | | Mail Merges a template file with the values in DataSource File and Hashtable and saves the result to a file.
Creation date: (3/15/02 10:44:02 AM)
Parameters: sTemplateFileName - java.lang.String Name of a word template file Parameters: sDataSourceFileName - java.lang.String Name of a DataSoure File usually a .csv file. Parameters: sSaveAsFileName - java.lang.String Name of the saved file Parameters: htFields - java.util.Hashtable A hashtable of field names & values to be used to populate template. |
mailMergeSaveAs | public static void mailMergeSaveAs(String sTemplateFileName, String sSaveAsFileName, Hashtable htFields) throws MailMergeException(Code) | | Mail Merges a template file with the values in the Hastable and saves the result to a file.
Creation date: (3/15/02 10:44:02 AM)
Parameters: sTemplateFileName - java.lang.String Name of a word template file Parameters: sSaveAsFileName - java.lang.String Name of the saved file Parameters: htFields - java.util.Hashtable A hashtable of field names & values to be used to populate template. |
print | public void print(String sTemplateFileName, String sDataSourceFileName) throws MailMergeException(Code) | | Prints a Template File after Mail Merging with a Datasource.
Creation date: (3/15/02 10:44:02 AM)
Parameters: sTemplateFileName - java.lang.String Name of the word template file Parameters: sDataSourceFileName - java.lang.String Name of the Data Source File usually a .csv file |
printToFile | public void printToFile(String sTemplateFileName, String sDataSourceFileName, String sPrintFileName) throws MailMergeException(Code) | | Prints to a File a Template File after Mail Merging with a Datasource.
Creation date: (3/15/02 10:44:02 AM)
Parameters: sTemplateFileName - java.lang.String Name of the word template file Parameters: sDataSourceFileName - java.lang.String Name of the Data Source File usually a .csv file Parameters: sPrintFileName - java.lang.String Name of the Print File Output. |
saveAs | public void saveAs(String sTemplateFileName, String sDataSourceFileName, String sSaveAsFileName) throws MailMergeException(Code) | | Saves to a File a Template File after Mail Merging with a Datasource.
Creation date: (3/15/02 10:44:02 AM)
Parameters: sTemplateFileName - java.lang.String Name of the word template file Parameters: sDataSourceFileName - java.lang.String Name of the Data Source File usually a .csv file Parameters: sSaveAsFileName - java.lang.String Name of the Saved File. |
setAutoPrint | public void setAutoPrint(boolean bAutoPrint) throws MailMergeException(Code) | | Indicates that if the document is view that it should auto print.
Creation date: (3/15/02 10:44:02 AM)
Parameters: bAutoPrint - boolean If true document will automatically print if viewed. |
setBackground | public void setBackground(File fBackground) throws MailMergeException(Code) | | Sets the Background of a Word Document.
Creation date: (3/15/02 10:44:02 AM)
Parameters: fBackground - java.io.File A File pointing to a background for the document |
setBottomMargin | public void setBottomMargin(float fBottomMargin)(Code) | | Sets the Bottom Margin of a Word Document.
Creation date: (3/15/02 10:44:02 AM)
Parameters: fBottomMargin - float Bottom Margin in Inches |
setFooterDistance | public void setFooterDistance(float fFooterDistance)(Code) | | Sets the Footer Distance of a Word Document.
Creation date: (3/15/02 10:44:02 AM)
Parameters: fFooterDistance - float Footer Distance in Inches |
setGutter | public void setGutter(float fGutter)(Code) | | Sets the Gutter of a Word Document.
Creation date: (3/15/02 10:44:02 AM)
Parameters: fGutter - float Gutter in Inches |
setHeaderDistance | public void setHeaderDistance(float fHeaderDistance)(Code) | | Sets the Header Distance of a Word Document.
Creation date: (3/15/02 10:44:02 AM)
Parameters: fHeaderDistance - float Header Distance in Inches |
setLeftMargin | public void setLeftMargin(float fLeftMargin)(Code) | | Sets the Left Margin of a Word Document.
Creation date: (3/15/02 10:44:02 AM)
Parameters: fLeftMargin - float Left Margin in Inches |
setPrinter | public void setPrinter(String sPrinter)(Code) | | Sets the Printer for a Word Document.
Creation date: (3/15/02 10:44:02 AM)
Parameters: sPrinter - java.lang.String A String representing the printer to print to. |
setRightMargin | public void setRightMargin(float fRightMargin)(Code) | | Sets the Right Margin of a Word Document.
Creation date: (3/15/02 10:44:02 AM)
Parameters: fRightMargin - float Right Margin in Inches |
setTopMargin | public void setTopMargin(float fTopMargin)(Code) | | Sets the Top Margin of a Word Document.
Creation date: (3/15/02 10:44:02 AM)
Parameters: fTopMargin - float Top Margin in Inches |
|
|