Package org.damap.base.conversion
Class AbstractTemplateExportFunctions
java.lang.Object
org.damap.base.conversion.AbstractTemplateExportFunctions
- Direct Known Subclasses:
AbstractTemplateExportSetup
Abstract AbstractTemplateExportFunctions class.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidMethod to do a replacement of variable with desired valuevoidformattingParagraph(List<org.apache.poi.xwpf.usermodel.XWPFParagraph> xwpfParagraphs, String startChar, String endChar) Method to preprocessing format of the paragraph listvoidformattingTable(List<org.apache.poi.xwpf.usermodel.XWPFTable> xwpfTables, String startChar, String endChar) Loop to format tables within tables in the template.List<org.apache.poi.xwpf.usermodel.XWPFTableCell>getAllOuterTableCells(org.apache.poi.xwpf.usermodel.XWPFDocument doc) Returns a list of all table cells of non nested tables in the document.List<org.apache.poi.xwpf.usermodel.XWPFTable>getAllTables(org.apache.poi.xwpf.usermodel.XWPFDocument doc) Returns a list of all tables and nested tables with depth 1.org.apache.poi.xwpf.usermodel.XWPFTableRowinsertNewTableRow(org.apache.poi.xwpf.usermodel.XWPFTableRow sourceTableRow, int pos) Method to add new row in a tablejoinWithComma(List<String> variableList) Method to combine multiple values become one string.joinWithCommaAnd(List<String> variableList) joinWithCommaAnd.org.apache.poi.xwpf.usermodel.XWPFDocumentloadTemplate(InputStream template, String startChar, String endChar) Method to load the export templatevoidremoveTable(org.apache.poi.xwpf.usermodel.XWPFDocument doc, org.apache.poi.xwpf.usermodel.XWPFTable table) Removes a table inside a document or nested inside another table.voidremoveTableAndParagraphAbove(org.apache.poi.xwpf.usermodel.XWPFDocument doc, org.apache.poi.xwpf.usermodel.XWPFTable table) Removes a table inside a document or nested inside another table.voidreplaceTextInFooter(org.apache.poi.xwpf.usermodel.XWPFDocument doc, Map<String, String> replacements) Method to do a replacement specific in document's footer areaorg.apache.poi.xwpf.usermodel.XWPFDocumenttemplateFormatting(org.apache.poi.xwpf.usermodel.XWPFDocument document, String startChar, String endChar) Method to format the template.
-
Field Details
-
formatter
-
-
Constructor Details
-
AbstractTemplateExportFunctions
public AbstractTemplateExportFunctions()
-
-
Method Details
-
loadTemplate
public org.apache.poi.xwpf.usermodel.XWPFDocument loadTemplate(InputStream template, String startChar, String endChar) throws Exception Method to load the export template- Parameters:
template- aInputStreamobjectstartChar- aStringobjectendChar- aStringobject- Returns:
- a
XWPFDocumentobject - Throws:
Exception
-
addReplacement
Method to do a replacement of variable with desired value -
insertNewTableRow
public org.apache.poi.xwpf.usermodel.XWPFTableRow insertNewTableRow(org.apache.poi.xwpf.usermodel.XWPFTableRow sourceTableRow, int pos) throws org.apache.xmlbeans.XmlException, IOException Method to add new row in a table- Parameters:
sourceTableRow- aXWPFTableRowobjectpos- a int- Returns:
- a
XWPFTableRowobject - Throws:
IOExceptionorg.apache.xmlbeans.XmlException
-
joinWithComma
Method to combine multiple values become one string. Can be used for generate values from a list of object or replace one variable with multiple values in one execution. -
joinWithCommaAnd
joinWithCommaAnd. -
templateFormatting
public org.apache.poi.xwpf.usermodel.XWPFDocument templateFormatting(org.apache.poi.xwpf.usermodel.XWPFDocument document, String startChar, String endChar) throws Exception Method to format the template. Parsing all text inside the document and preprocessing the variables (currently, text started with "[" and end with "]") that are seperated to multiple runs. -
formattingTable
public void formattingTable(List<org.apache.poi.xwpf.usermodel.XWPFTable> xwpfTables, String startChar, String endChar) Loop to format tables within tables in the template. -
formattingParagraph
public void formattingParagraph(List<org.apache.poi.xwpf.usermodel.XWPFParagraph> xwpfParagraphs, String startChar, String endChar) Method to preprocessing format of the paragraph list -
removeTable
public void removeTable(org.apache.poi.xwpf.usermodel.XWPFDocument doc, org.apache.poi.xwpf.usermodel.XWPFTable table) Removes a table inside a document or nested inside another table. For nested tables, this works only for depth 1. If the table is not to be found inside the doc or at depth 1, nothing happens.- Parameters:
doc- aXWPFDocumentobjecttable- aXWPFTableobject
-
removeTableAndParagraphAbove
public void removeTableAndParagraphAbove(org.apache.poi.xwpf.usermodel.XWPFDocument doc, org.apache.poi.xwpf.usermodel.XWPFTable table) Removes a table inside a document or nested inside another table. Also removes the paragraph above it. For nested tables, this works only for depth 1. If the table is not to be found inside the doc or at depth 1, nothing happens. If the there is no paragraph above the table, only the table will be removed.- Parameters:
doc- aXWPFDocumentobjecttable- aXWPFTableobject
-
getAllOuterTableCells
public List<org.apache.poi.xwpf.usermodel.XWPFTableCell> getAllOuterTableCells(org.apache.poi.xwpf.usermodel.XWPFDocument doc) Returns a list of all table cells of non nested tables in the document.- Parameters:
doc- aXWPFDocumentobject- Returns:
- a
Listobject
-
getAllTables
public List<org.apache.poi.xwpf.usermodel.XWPFTable> getAllTables(org.apache.poi.xwpf.usermodel.XWPFDocument doc) Returns a list of all tables and nested tables with depth 1.- Parameters:
doc- aXWPFDocumentobject- Returns:
- a
Listobject
-