Page 1 of 1

not seeing AlternateContent content

PostPosted: Thu Aug 06, 2015 8:25 am
by desau
Hi all,

Been using docx4j for a long time now .. I'm currently using version 2.8.0 (yes -- I know .. why haven't I upgraded).

Perhaps upgrading would just solve my problem..

I'm seeing this node in my docx: <mc:AlternateContent>

When I look for the text content under the paragraph which is the container for that node, I get the text which is contained in the AlternateContent as well as the text that's not in AlternateContent. I get this text content using TextUtils.extractText().

However, the paragraph node (P)'s paragraphContent does not include the AlternateContent node, nor any of its descendants.

How can I get the AlternateContent?

Re: not seeing AlternateContent content

PostPosted: Tue Aug 11, 2015 6:56 pm
by jason
Short answer: you can't.

https://github.com/plutext/docx4j/blob/ ... .java#L452 selects one version of the content, using https://github.com/plutext/docx4j/blob/ ... essor.xslt

That's the case wherever the original xsd (and thus generated java classes) don't explicitly allow for AlternateContent. (There are a couple of places where it is explicitly allowed)

desau wrote:When I look for the text content under the paragraph which is the container for that node, I get the text which is contained in the AlternateContent as well as the text that's not in AlternateContent. I get this text content using TextUtils.extractText().


Given the above, I'm not sure how this could be.