My aim is to accept all revisions for a .docx files using Java. I've already used the apache-poi project to highlight sentences in docx, so I'm not entirely new to that project.
Here is what I've found till now:
- C# and Visual basic official code for accepting all revisions
- A Java proposed workaround that uses apache-poi to get the text but does not accept the revisions:
public static String getBasicTextFromParagraphWithoutDeletions(XWPFParagraph par) { StringBuffer out = new StringBuffer(); for (IRunElement run : par.getIRuns()) { if (run instanceof XWPFRun) { XWPFRun xRun = (XWPFRun) run; if (xRun.getCTR().getRsidDel() == null) { out.append(xRun.toString()); } } else if (run instanceof XWPFSDT) { out.append(((XWPFSDT) run).getContent().getText()); } else { out.append(run.toString()); } } return out.toString(); }
- A perl or python proposal to accept all revisions
Does anyone knows if there is a way to accept the revisions in java too?
Thanks.