Page 1 of 1

RemovalHandler not removing controls

PostPosted: Thu Sep 20, 2012 8:08 am
by GAlfstad
In the ContentControlsMergeXML sample I open the processed document in MS Word and click on the Design Mode and there control tags shown. Why did the call to RemoveHandler shown below not remove them?

RemovalHandler rh = new RemovalHandler();
rh.removeSDTs(wordMLPackage, Quantifier.ALL);

In the ContentControlBindingExtensions sample the content controls are stripped from the processed document. Why the difference?

Re: RemovalHandler not removing controls

PostPosted: Sat Sep 29, 2012 2:39 pm
by jason
RemovalHanlder will only remove a content control if it has a tag containing 'od' stuff, as shown in the following xsl:when

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
                        <xsl:when
                                test="$xpath and contains(w:sdtPr/w:tag/@w:val, 'od:xpath=') or $repeat and contains(w:sdtPr/w:tag/@w:val, 'od:repeat=') or $condition and contains(w:sdtPr/w:tag/@w:val, 'od:condition=')">
 
Parsed in 0.000 seconds, using GeSHi 1.0.8.4


The SDT in the example you mention just uses plain old bindings, and doesn't have the 'od' (OpenDoPE) stuff:

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
        <w:sdtPr>
          <w:rPr>
            <w:lang w:val="x-none"/>
          </w:rPr>
          <w:alias w:val="Data value: element"/>
          <w:id w:val="-1309316605"/>
          <w:dataBinding w:storeItemID="{5448916C-134B-45E6-B8FE-88CC1FFC17C3}" w:xpath="/myxml[1]/element1[1]" w:prefixMappings=""/>
          <w:text w:multiLine="true"/>
        </w:sdtPr>
 
Parsed in 0.001 seconds, using GeSHi 1.0.8.4


and so it is retained.