Hi,
I have same content in both two documents, one docx is getting all placeholders replaced perfectly but other docx couldn't. The paragraph which contains placeholder is not dividing its children that's what i observed while debugging. Can you please let me know whats wrong with that file. I will attach both files here.
And Xml also.
This is how i am replacing my placeholders.
for(String bMark: bookMarks.keySet()){
//String bMark = "@parking";
String as[] = null;
boolean found = false;
for (Object p : paragraphs) {
found = false;
List<Object> texts = getAllElementFromObject(p, Text.class);
for (Object t : texts) {
Text content = (Text) t;
if (null != content.getValue() && content.getValue().equals(bMark)) {
toReplace = (P) p;
found = true;
List<?> textList = getAllElementFromObject(toReplace, Text.class);
if (textList.size() > 0) {
for(int k=0; k<textList.size();k++){
Text textToReplace = (Text) textList.get(k);
if(textToReplace.getValue().equals(bMark)){
textToReplace.setValue((String)bookMarks.get(bMark));
/* as = StringUtils.splitPreserveAllTokens((String)bookMarks.get(bMark), '\n');
((ContentAccessor)toReplace.getParent()).getContent().remove(toReplace);*/
break;
}
}
}
}
}
}
}
Please provide me some solution. And i want to know why same content is not able to replace data.