Page 1 of 1

NOT IMPLEMENTED: support for w:instrText - red text in PDF

PostPosted: Tue Jun 25, 2019 8:12 pm
by mmedvedskiy
Greetings.

When I use custom doc properties (an analog of user variables from OpenOffice) in a document (in context of setting these properties' values with DocPropsCustomPart, but it is so even if the "Custom Doc Property" is simply present in the document, that is getting converted to PDF), then convert it in PFD with Docx4J.toPDF(), I get red "NOT IMPLEMENTED: support for w:instrText -" in the document itself. But the doc properties do actually get processed and do change their values.

So, the question is - why does this text appear in the PFD result document, and how do I disable it (or even if I should, if there is a fix, and it is me doing something wrong, please do tell)?

I'm working with simple Java-maven application, no JBOSS, no server utils, nothing, simply the docx4j 8.0.0 library.

Re: NOT IMPLEMENTED: support for w:instrText - red text in P

PostPosted: Thu Jul 04, 2019 11:31 am
by jason
This means field w:instrText isn't supported in https://github.com/plutext/docx4j/tree/ ... -export-fo

Try using simple fields instead of complex fields?

Re: NOT IMPLEMENTED: support for w:instrText - red text in P

PostPosted: Fri Jul 05, 2019 1:15 am
by mmedvedskiy
jason wrote:This means field w:instrText isn't supported in https://github.com/plutext/docx4j/tree/ ... -export-fo

Try using simple fields instead of complex fields?

Is there any way to simply disable this red text appearing in the result .pdf file? It completely ruins the result of my operations.

Re: NOT IMPLEMENTED: support for w:instrText - red text in P

PostPosted: Sat Jul 06, 2019 2:34 am
by jason
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
        public static DocumentFragment notImplemented(AbstractConversionContext context, NodeIterator nodes, String message) {
                return context.getMessageWriter().notImplemented(context, nodes, message);
        }
 
Parsed in 0.013 seconds, using GeSHi 1.0.8.4


Then we have:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
public abstract class AbstractMessageWriter {
       
        public DocumentFragment notImplemented(AbstractConversionContext context, NodeIterator nodes, String message) {

                Node n = nodes.nextNode();
                context.getLog().warn("NOT IMPLEMENTED: support for "+ n.getNodeName() + "; " + message);
               
                if (context.getLog().isDebugEnabled() ) {
                       
                        if (message==null) message="";
                       
                        context.getLog().debug( XmlUtils.w3CDomNodeToString(n)  );

                        // Return something which will show up in the HTML
                        return message(context, "NOT IMPLEMENTED: support for " + n.getNodeName() + " - " + message);
 
Parsed in 0.014 seconds, using GeSHi 1.0.8.4


See docx-java-f6/how-to-turn-off-log4j-debug-level-logging-for-xslfo-t1658.html

docx4j uses slf4j, so how to do that depends on your concrete logging implementation. But with docx4j 8 you're likely to be using log4j or logback.