public class MailMerger extends Object
Modifier and Type | Class and Description |
---|---|
protected static class |
MailMerger.FormTextFieldNames
If we're converting MERGEFIELD to FORMTEXT, it is
desirable to make the w:fldChar/w:ffData/w:name
unique within the docx (though Word 2010 can still open the docx if they
aren't), and to remove spaces
|
static class |
MailMerger.OutputField |
Modifier and Type | Field and Description |
---|---|
protected static MailMerger.OutputField |
fieldFate |
Constructor and Description |
---|
MailMerger() |
Modifier and Type | Method and Description |
---|---|
protected static void |
canonicaliseStarts(ComplexFieldLocator fl,
List<FieldRef> fieldRefs) |
protected static String |
extractInstr(List<Object> instructions) |
static WordprocessingMLPackage |
getConsolidatedResultCrude(WordprocessingMLPackage input,
List<Map<DataFieldName,String>> data)
A "poor man's" approach, which generates the mail merge
results as a single docx, and just hopes for the best.
|
static WordprocessingMLPackage |
getConsolidatedResultCrude(WordprocessingMLPackage input,
List<Map<DataFieldName,String>> data,
boolean processHeadersAndFooters)
A "poor man's" approach, which generates the mail merge
results as a single docx, and just hopes for the best.
|
protected static String |
getDatafieldNameFromInstr(String instr)
Get the datafield name from, for example
|
protected static String |
getTextInsideContent(ContentAccessor paragraph)
Parse through all content inside the paragraph to concatenate all values inside a text
|
static void |
performMerge(WordprocessingMLPackage input,
Map<DataFieldName,String> data,
boolean processHeadersAndFooters)
Perform merge on a single instance.
|
protected static void |
recursiveRemove(ContentAccessor content,
Object needToBeRemoved)
To remove an object from the docx template
|
protected static void |
removeSimpleField(FieldRef fr)
Remove the field but preserve the paragraph and content around it
|
protected static void |
setFormFieldProperties(FieldRef fr,
String ffName,
String ffTextInputFormat) |
static void |
setMERGEFIELDInOutput(MailMerger.OutputField fieldFate)
What to do with the MERGEFIELD in the output docx.
|
protected static MailMerger.OutputField fieldFate
public static WordprocessingMLPackage getConsolidatedResultCrude(WordprocessingMLPackage input, List<Map<DataFieldName,String>> data) throws Docx4JException
input
- data
- Docx4JException
public static WordprocessingMLPackage getConsolidatedResultCrude(WordprocessingMLPackage input, List<Map<DataFieldName,String>> data, boolean processHeadersAndFooters) throws Docx4JException
input
- data
- processHeadersAndFooters
- process headers and footers in FIRST section only.
If you have multiple sections in your input docx, performMerge is a better approachDocx4JException
public static void performMerge(WordprocessingMLPackage input, Map<DataFieldName,String> data, boolean processHeadersAndFooters) throws Docx4JException
input
- data
- processHeadersAndFooters
- Docx4JException
protected static void canonicaliseStarts(ComplexFieldLocator fl, List<FieldRef> fieldRefs) throws Docx4JException
fl
- fieldRefs
- Docx4JException
protected static String getDatafieldNameFromInstr(String instr)
protected static void removeSimpleField(FieldRef fr)
fr
- protected static String getTextInsideContent(ContentAccessor paragraph)
paragraph
- The paragraph which contains (or not) dataprotected static void recursiveRemove(ContentAccessor content, Object needToBeRemoved)
content
- Body (or other part) of the templateneedToBeRemoved
- The object that will be removed from the contentpublic static void setMERGEFIELDInOutput(MailMerger.OutputField fieldFate)
fieldFate
- Copyright © 2007-2019. All Rights Reserved.