You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2018/02/27 11:22:18 UTC

[Bug 62138] New: Undefined results for insertNewRun() method when XWPFParagraph contains SDT runs

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

            Bug ID: 62138
           Summary: Undefined results for insertNewRun() method when
                    XWPFParagraph contains SDT runs
           Product: POI
           Version: 3.14-FINAL
          Hardware: PC
            Status: NEW
          Severity: major
          Priority: P2
         Component: XWPF
          Assignee: dev@poi.apache.org
          Reporter: radu.c.stefanescu@gmail.com
  Target Milestone: ---

Problem:
I have a paragraph that contains one SDT element (Checkbox) on position 0 and
some text on the next runs. I want to insert a text run BEFORE the SDT element
in the paragraph, but calling the following method does not yield the expected
results:

paragraph.insertNewRun(0);

The insertNewRun method, when doing the synchronization between the Run list
and the IRun list, will make no assumptions about the ordering of XWPFSDT and
XWPFRun types of elements in the IRun list, which in this case is not yielding
the desired result, as a client of the API will not be able to order the
sequence of IRunElements as desired.

In the example before, the new text run (XWPFRun) is inserted on position 1,
rather then before the XWPFSDT element.
This is happening due to this logic:

// To update the iruns, find where we're going
            // in the normal runs, and go in there
            int iPos = iruns.size();
            if (pos < runs.size()) {
                XWPFRun oldAtPos = runs.get(pos);
                int oldAt = iruns.indexOf(oldAtPos);
                if (oldAt != -1) {
                    iPos = oldAt;
                }
            }

Possible solution: enrich the API for XWPFParagraph with a method that inserts
directly in the IRun list in order to be able to control the correct order of
runs.

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


[Bug 62138] Undefined results for insertNewRun() method when XWPFParagraph contains SDT runs

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62138

Dominik Stadler <do...@gmx.at> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All

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