[Bug 64561] New: [PATCH] XWPFSDTContent.getText() is empty for nested SDT elements

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug 64561] New: [PATCH] XWPFSDTContent.getText() is empty for nested SDT elements

Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=64561

            Bug ID: 64561
           Summary: [PATCH] XWPFSDTContent.getText() is empty for nested
                    SDT elements
           Product: POI
           Version: unspecified
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XWPF
          Assignee: [hidden email]
          Reporter: [hidden email]
  Target Milestone: ---

Created attachment 37331
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=37331&action=edit
patch produced by SVN diff

The current implementation of XWPFSDTContent, more specifically its constructor

        public XWPFSDTContent(CTSdtContentRun sdtRun, IBody part, IRunBody
parent)

uses sdtRun.getRArray() to obtain its body elements. Thus only runs (class CTR)
are considered as body elements.

However, I am currently working on a project where most documents come with a
level-2 nesting of <w:sdt> Tags (apparently this is required in order to manage
lists of custom controls).

Furthermore, we create a search index for our *.docx files based on getText(),
which currently misses the parts that are stored in nested <w:sdt> Tags.

The attached patch is a minor modification that would improve this situation by
considering also CTSdtRuns (in addition to CTRs) when collecting the body
elements of an XWPFSDTContent.

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 64561] [PATCH] XWPFSDTContent.getText() is empty for nested SDT elements

Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=64561

PJ Fanning <[hidden email]> changed:

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

--- Comment #1 from PJ Fanning <[hidden email]> ---
thanks but could you provide test coverage, eg a file that demos the issue and
a unit test that checks the results when using that file?

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 64561] [PATCH] XWPFSDTContent.getText() is empty for nested SDT elements

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=64561

Christian Sternagel <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #37331|0                           |1
        is obsolete|                            |
                 CC|                            |[hidden email]

--- Comment #2 from Christian Sternagel <[hidden email]> ---
Created attachment 37332
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=37332&action=edit
patch (produced by SVN diff) including testcase

I modified the patch to also include a testcase. Since I was not sure whether
to include the required *.docx file in the patch, I will just add it as a
separate attachment.

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 64561] [PATCH] XWPFSDTContent.getText() is empty for nested SDT elements

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=64561

--- Comment #3 from Christian Sternagel <[hidden email]> ---
Created attachment 37333
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=37333&action=edit
minimal example with nested SDTs

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 64561] [PATCH] XWPFSDTContent.getText() is empty for nested SDT elements

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=64561

PJ Fanning <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #4 from PJ Fanning <[hidden email]> ---
thanks - committed with https://svn.apache.org/repos/asf/poi/trunk@1879223 -
with 1 bug (on my part) that was later fixed

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 64561] [PATCH] XWPFSDTContent.getText() is empty for nested SDT elements

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=64561

--- Comment #5 from Christian Sternagel <[hidden email]> ---
Great! Thank you.

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]