https://bz.apache.org/bugzilla/show_bug.cgi?id=65282

            Bug ID: 65282
           Summary: XWPFParagraph's addRun method only adds to run
                    collection, missing iRun collection
           Product: POI
           Version: 5.0.0-FINAL
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XWPF
          Assignee: dev@poi.apache.org
          Reporter: szemereszem...@gmail.com
  Target Milestone: ---

I am copying a run in the current paragraph into a prior paragraph (priorP).

XmlObject newRunXml = run.getCTR().copy();
XWPFRun newRun = new XWPFRun((CTR) newRunXml, (IRunBody) priorP);
priorP.addRun(newRun);

This last method call only adds the run to the run collection, not the iRun
collection and is never written on write to file (possible as a result).

A workaround is to write my own addRun method, based on the protected addRun
method in XWPFParagraph:

private static void addRun(XWPFParagraph p, CTR run) {
  CTP ctp = p.getCTP();
  int pos = ctp.sizeOfRArray();
  ctp.addNewR();
  ctp.setRArray(pos, run);
}

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
For additional commands, e-mail: dev-h...@poi.apache.org

Reply via email to