replace text with paragraph
Posted: Tue Nov 08, 2011 5:40 am
I want to modify my word by replacing place holders with actual text , in my case I created a placeholder and would like to replace this with a paragraph , I tried the example of replacing text , but can I replace a simple text with whole paragraph ?
I tried playing with OpenMainDocumentAndTraverse.java, this is what I tried and it worked , now I want to create a new paragraph and replace it if text is formattedAuditNumber , please advice me how to.
Thanks a lot.
- Code: Select all
@Override
public List<Object> apply(Object object) {
if (object instanceof org.docx4j.wml.Text){
Text wText=(org.docx4j.wml.Text) object;
if(wText.getValue().equals("formattedAuditNumber")){
wText.setValue("A-123-456-9876");
}
}
return null;
}
I tried playing with OpenMainDocumentAndTraverse.java, this is what I tried and it worked , now I want to create a new paragraph and replace it if text is formattedAuditNumber , please advice me how to.
Thanks a lot.