public class MailMerger
extends java.lang.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,
java.util.List<FieldRef> fieldRefs) |
protected static java.lang.String |
extractInstr(java.util.List<java.lang.Object> instructions) |
static WordprocessingMLPackage |
getConsolidatedResultCrude(WordprocessingMLPackage input,
java.util.List<java.util.Map<DataFieldName,java.lang.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,
java.util.List<java.util.Map<DataFieldName,java.lang.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 java.lang.String |
getDatafieldNameFromInstr(java.lang.String instr)
Get the datafield name from, for example
|
protected static java.lang.String |
getTextInsideContent(ContentAccessor paragraph)
Parse through all content inside the paragraph to concatenate all values inside a text
|
static void |
performMerge(WordprocessingMLPackage input,
java.util.Map<DataFieldName,java.lang.String> data,
boolean processHeadersAndFooters)
Perform merge on a single instance.
|
protected static void |
recursiveRemove(ContentAccessor content,
java.lang.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,
java.lang.String ffName,
java.lang.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, java.util.List<java.util.Map<DataFieldName,java.lang.String>> data) throws Docx4JException
input - data - Docx4JExceptionpublic static WordprocessingMLPackage getConsolidatedResultCrude(WordprocessingMLPackage input, java.util.List<java.util.Map<DataFieldName,java.lang.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 approachDocx4JExceptionpublic static void performMerge(WordprocessingMLPackage input, java.util.Map<DataFieldName,java.lang.String> data, boolean processHeadersAndFooters) throws Docx4JException
input - data - processHeadersAndFooters - Docx4JExceptionprotected static void canonicaliseStarts(ComplexFieldLocator fl, java.util.List<FieldRef> fieldRefs) throws Docx4JException
fl - fieldRefs - Docx4JExceptionprotected static java.lang.String getDatafieldNameFromInstr(java.lang.String instr)
protected static java.lang.String extractInstr(java.util.List<java.lang.Object> instructions)
protected static void removeSimpleField(FieldRef fr)
fr - protected static java.lang.String getTextInsideContent(ContentAccessor paragraph)
paragraph - The paragraph which contains (or not) dataprotected static void recursiveRemove(ContentAccessor content, java.lang.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 - protected static void setFormFieldProperties(FieldRef fr, java.lang.String ffName, java.lang.String ffTextInputFormat)
Copyright © 2007–2023. All rights reserved.