Class DocumentUtil
- java.lang.Object
-
- org.wickedsource.docxstamper.util.DocumentUtil
-
public class DocumentUtil extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> List<T>extractElements(Object object, Class<T> elementClass)static StringgetImageRelationshipId(org.docx4j.wml.Drawing drawing)Retrieve an embedded drawing relationship id.static List<org.docx4j.wml.P>getParagraphsFromObject(Object parentObject)static List<org.docx4j.wml.Tc>getTableCellsFromObject(Object parentObject)static List<org.docx4j.wml.Tbl>getTableFromObject(Object parentObject)static List<org.docx4j.wml.Tr>getTableRowsFromObject(Object parentObject)static List<Object>prepareDocumentForInsert(org.docx4j.openpackaging.packages.WordprocessingMLPackage sourceDocument, org.docx4j.openpackaging.packages.WordprocessingMLPackage targetDocument)Recursively walk through the content accessor to replace embedded images and import the matching files to the destination document before importing content.static List<Object>walkObjectsAndImportImages(org.docx4j.wml.ContentAccessor sourceContainer, org.docx4j.openpackaging.packages.WordprocessingMLPackage sourceDocument, org.docx4j.openpackaging.packages.WordprocessingMLPackage destDocument)Recursively walk through the content accessor to replace embedded images and import the matching files to the destination document.
-
-
-
Method Detail
-
prepareDocumentForInsert
public static List<Object> prepareDocumentForInsert(org.docx4j.openpackaging.packages.WordprocessingMLPackage sourceDocument, org.docx4j.openpackaging.packages.WordprocessingMLPackage targetDocument) throws Exception
Recursively walk through the content accessor to replace embedded images and import the matching files to the destination document before importing content.- Parameters:
sourceDocument- document to import.targetDocument- document to add the source document content to.- Returns:
- the whole content of the source document with imported images replaced.
- Throws:
Exception
-
walkObjectsAndImportImages
public static List<Object> walkObjectsAndImportImages(org.docx4j.wml.ContentAccessor sourceContainer, org.docx4j.openpackaging.packages.WordprocessingMLPackage sourceDocument, org.docx4j.openpackaging.packages.WordprocessingMLPackage destDocument) throws Exception
Recursively walk through the content accessor to replace embedded images and import the matching files to the destination document.- Parameters:
sourceContainer- source container to walk.sourceDocument- source document containing image files.destDocument- destination document to add image files to.- Returns:
- the list of imported objects from the source container.
- Throws:
Exception
-
getImageRelationshipId
public static String getImageRelationshipId(org.docx4j.wml.Drawing drawing)
Retrieve an embedded drawing relationship id.- Parameters:
drawing- the drawing to get the relationship id.- Returns:
- the id of the graphic
-
getParagraphsFromObject
public static List<org.docx4j.wml.P> getParagraphsFromObject(Object parentObject)
-
getTableRowsFromObject
public static List<org.docx4j.wml.Tr> getTableRowsFromObject(Object parentObject)
-
-