Is there way with apache xwpf libary to add new table to specific place inside doc where is placeholder?
` for (XWPFParagraph paragraph : document.getParagraphs()) {
for (XWPFRun run : paragraph.getRuns()) {
String text = run.getText(0);
if (text != null) {
for (Map.Entry<String, String> entry : data.entrySet()) {
if (entry.getValue() != null) {
text = text.replace(entry.getKey(), entry.getValue());
}
}
if (text.equals(placeholder)) {
//i want to add table here
} else {
String[] lines = text.split("\n");
if (lines.length > 1) {
run.setText("", 0);
run.setText(lines[0], 0);
for (int i = 1; i < lines.length; i++) {
run.addBreak();
run.setText(lines[i], i);
}
} else {
run.setText(text, 0);
}
}
}
}
}
Its always add at end of docx when I create table.