Page 1 of 1

Any way to strip Smart Tags from a .docx file

PostPosted: Tue Mar 17, 2015 10:09 pm
by danhaywood
I'm using docx4j (in an open source project, https://github.com/isisaddons/isis-module-docx) to convert a Word .docx template file into a .docx. Using the docx4j API I have fashioned support for repeating data (tables and lists), and it works quite well.

However, the resultant .docx still has the original smart tags within it, albeit that their content is replaced with the text that I insert using the docx4j APIs.

My question is: is there any API for me to post-process my .docx so that I can remove these smart tags?

Many thanks
Dan

Re: Any way to strip Smart Tags from a .docx file

PostPosted: Wed Mar 18, 2015 9:59 am
by jason
I see you say "smart tags", but for clarity, could you provide a snippet of XML?

(If you actually meant content controls, we have RemovalHandler)

Re: Any way to strip Smart Tags from a .docx file

PostPosted: Thu Mar 19, 2015 8:07 pm
by danhaywood
Ah yes, I think I did mean content controls.

I'll take a look at the RemovalHandler, then.

Thanks!

Re: Any way to strip Smart Tags from a .docx file

PostPosted: Fri Mar 20, 2015 5:46 pm
by jason
No worries, feel free to post again if you have any trouble working out how to use it.

Note that it uses XSLT. For performance reasons, I'd like to implement a non-XSLT equivalent when I get the chance.