It is currently Sat Jul 19, 2025 11:36 am
List<Object> texts = getAllElementFromObject(template.getMainDocumentPart(), Text.class);
replacePlaceHolders(texts, mappings);
private static void replacePlaceHolders(List<?> texts,Map<String, String> mappings){
for (Object object : texts) {
Text textElement=(Text)object;
String textToReplace=textElement.getValue();
if(mappings.keySet().contains(textToReplace)){
textElement.setValue(mappings.get(textToReplace));
}
}
}
Total posts 10186 • Total topics 2866 • Total members 2096