Page 1 of 1

HtmlExporterNG2 and Track Changes

PostPosted: Tue Mar 19, 2013 5:52 am
by jallen
Hi Jason,

Do you know a easy way to not include all of the 'Track Changes' markup in the converted HTML when using HtmlExporterNG2? I want the HTML to look like the 'Final' version of the word document.

Thanks,
Jeff

Re: HtmlExporterNG2 and Track Changes

PostPosted: Tue Mar 19, 2013 11:11 pm
by jason
Conceptually, I'd be inclined to have a method (call it 'acceptChanges') which could be invoked before you generate the HTML output. But I don't think we have that yet. And the downside is from an efficiency point of view, it would be an additional traversal of the document.

The XSLT in package org.docx4j.convert.out.html contains:

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting

                                        /*element styles*/ .del
                                        {text-decoration:line-through;color:red;}
                                        <xsl:choose>
                                                <xsl:when test="/w:document/w:settings/w:trackRevisions">
                                                  .ins {text-decoration:none;background:#c0ffc0;padding:1px;}
                                                </xsl:when>
                                                <xsl:otherwise>
                                                  .ins {text-decoration:none;background:#c0ffc0;padding:1px;}
                                                </xsl:otherwise>
                                        </xsl:choose>



  <xsl:template match="w:ins">
        <span class="ins">
                <xsl:apply-templates/>
        </span>
  </xsl:template>      

  <xsl:template match="w:del">
                <xsl:apply-templates/>
  </xsl:template>      

  <xsl:template match="w:delText">
        <span class="del">
                <xsl:apply-templates/>
        </span>
  </xsl:template>      
 
Parsed in 0.001 seconds, using GeSHi 1.0.8.4


so an expdient approach would be to alter the CSS definitions, or change these templates.

Re: HtmlExporterNG2 and Track Changes

PostPosted: Tue Apr 09, 2013 1:27 am
by jallen
For anyone else who runs into this, I modified the xslt style sheet and it seems to be working.

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  <xsl:template match="w:ins">
<!--    <span class="ins">-->
                <xsl:apply-templates/>
<!--    </span>-->
  </xsl:template>      

  <xsl:template match="w:del">
<!--            <xsl:apply-templates/>-->
  </xsl:template>      

  <xsl:template match="w:delText">
<!--    <span class="del">-->
<!--            <xsl:apply-templates/>-->
<!--    </span>-->
  </xsl:template>      
Parsed in 0.001 seconds, using GeSHi 1.0.8.4