Created attachment 37331 [details] 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.
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?
Created attachment 37332 [details] 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.
Created attachment 37333 [details] minimal example with nested SDTs
thanks - committed with https://svn.apache.org/repos/asf/poi/trunk@1879223 - with 1 bug (on my part) that was later fixed
Great! Thank you.