Can you attach sample word document you trying to work on?
peter_budo
Code tags enforcer
15,436 posts since Dec 2004
Reputation Points: 2,806
Solved Threads: 902
OK, looking at POI code XWPFTableCell consists of number of XWPFParagraphs of which you need to take care. So you need to remove all paragraphs in order to have text replace. You can do something like this
if ((cellNum + 1) == 2) {
if (tableCellVal != null) {
if (tableCellVal.length() > 0) {
removeParagraphs(tableCell);
tableCell.setText("CHANGE");
} else {
//tableCell.setText("NULL");
}
}
}
where removeParagraphs can look like this
private static void removeParagraphs(XWPFTableCell tableCell) {
int count = tableCell.getParagraphs().size();
for(int i = 0; i < count; i++){
tableCell.removeParagraph(i);
}
}
peter_budo
Code tags enforcer
15,436 posts since Dec 2004
Reputation Points: 2,806
Solved Threads: 902