Page 1 of 1

new bee trying replace contentControl

PostPosted: Wed Feb 27, 2013 9:07 am
by fachhoch
I am new bee trying to replace content control, I created a docx file with contentControls. In the examples all content parts has databinging , but word does not put databinding I have no clue how to add databingind , please advice how to add databinding . My goal is to retrieve each place holder with storeItemId

and replace it with data as metioned in example org.docx4j.samples.ContentControlsXmlEdit

Code: Select all
      String itemId = "{5448916C-134B-45E6-B8FE-88CC1FFC17C3}".toLowerCase();
      CustomXmlDataStoragePart customXmlDataStoragePart = wordMLPackage.getCustomXmlDataStorageParts().get(itemId);
      // .. if you don't know the itemId (which you can get using ContentControlsPartsInfo),
      // you could get the part by name, by type,
      // or you could find the item Id by looking in an SDT for w:storeItemID:
      //  <w:sdt>
      //    <w:sdtPr>
      //      <w:dataBinding w:prefixMappings="" w:xpath="/myxml[1]/element1[1]"
      //               w:storeItemID="{5448916C-134B-45E6-B8FE-88CC1FFC17C3}"/>
      //    </w:sdtPr>
      //    <w:sdtContent>      
      
      // Get the contents      
      CustomXmlDataStorage customXmlDataStorage = customXmlDataStoragePart.getData();
         // In a real program what you might do is populate this with your own data.
         // You could replace the whole part (as is done in https://github.com/plutext/OpenDoPE-WAR/blob/master/webapp-simple/src/main/java/org/opendope/webapp/SubmitBoth.java ),
          // or as we show below, just set some particular value
      
            
      // Change its contents.  Here we use XPath, but you could get the DOM document:
      //   ((CustomXmlDataStorageImpl)customXmlDataStorage).getDocument()
      // and do whatever ....
      ((CustomXmlDataStorageImpl)customXmlDataStorage).setNodeValueAtXPath("/myxml/element1", example_value_to_inject,
            "xmlns:ns0='http://your.namespace'"); // no prefix mappings required here, but that shows you how to do it




Please need help in adding databinding to my document. Please advice.

I am playing with the attached docx this has content controls but no datbinging nor itemId.Please advice how to add itemId and datbinging.
contentcontrol.docx
(15.99 KiB) Downloaded 395 times

here xml fo this docx

Code: Select all
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<w:document xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml">
   <w:body>
      <w:p>
         <w:pPr>
            <w:pStyle w:val="SigBox"/>
            <w:tabs>
               <w:tab w:val="clear" w:pos="4320"/>
               <w:tab w:val="clear" w:pos="8640"/>
            </w:tabs>
            <w:jc w:val="center"/>
            <w:rPr>
               <w:b/>
               <w:szCs w:val="24"/>
               <w:u w:val="single"/>
            </w:rPr>
         </w:pPr>
         <w:r>
            <w:rPr>
               <w:b/>
               <w:szCs w:val="24"/>
               <w:u w:val="single"/>
            </w:rPr>
            <w:t>CERTIFIED MAIL - RETURN RECEIPT REQUESTED</w:t>
         </w:r>
      </w:p>
      <w:sdt>
         <w:sdtPr>
            <w:rPr>
               <w:szCs w:val="24"/>
            </w:rPr>
            <w:id w:val="-889017388"/>
            <w:placeholder>
               <w:docPart w:val="EDCA2E64CFCD4F488D76F03E8327CACD"/>
            </w:placeholder>
            <w:text/>
         </w:sdtPr>
         <w:sdtContent>
            <w:p>
               <w:pPr>
                  <w:pStyle w:val="SigBox"/>
                  <w:tabs>
                     <w:tab w:val="clear" w:pos="4320"/>
                     <w:tab w:val="clear" w:pos="8640"/>
                  </w:tabs>
                  <w:ind w:left="2880" w:firstLine="720"/>
                  <w:rPr>
                     <w:sz w:val="22"/>
                     <w:szCs w:val="22"/>
                  </w:rPr>
               </w:pPr>
               <w:r>
                  <w:rPr>
                     <w:sz w:val="22"/>
                     <w:szCs w:val="22"/>
                  </w:rPr>
                  <w:t xml:space="preserve"/>
               </w:r>
               <w:proofErr w:type="gramStart"/>
               <w:r>
                  <w:rPr>
                     <w:sz w:val="22"/>
                     <w:szCs w:val="22"/>
                  </w:rPr>
                  <w:t>facIdentificationNumber</w:t>
               </w:r>
               <w:proofErr w:type="gramEnd"/>
            </w:p>
         </w:sdtContent>
      </w:sdt>
      <w:p>
         <w:pPr>
            <w:spacing w:after="0"/>
            <w:rPr>
               <w:rFonts w:ascii="Times New Roman" w:hAnsi="Times New Roman"/>
            </w:rPr>
         </w:pPr>
      </w:p>
      <w:p>
         <w:pPr>
            <w:spacing w:after="0"/>
            <w:rPr>
               <w:rFonts w:ascii="Times New Roman" w:hAnsi="Times New Roman"/>
               <w:highlight w:val="yellow"/>
            </w:rPr>
         </w:pPr>
      </w:p>
      <w:sdt>
         <w:sdtPr>
            <w:rPr>
               <w:rFonts w:ascii="Times New Roman" w:hAnsi="Times New Roman"/>
               <w:b/>
            </w:rPr>
            <w:tag w:val="adl/transmittalLetterDate"/>
            <w:id w:val="-885164104"/>
            <w:placeholder>
               <w:docPart w:val="EDCA2E64CFCD4F488D76F03E8327CACD"/>
            </w:placeholder>
            <w:text/>
         </w:sdtPr>
         <w:sdtContent>
            <w:p>
               <w:pPr>
                  <w:spacing w:after="0"/>
                  <w:rPr>
                     <w:rFonts w:ascii="Times New Roman" w:hAnsi="Times New Roman"/>
                     <w:b/>
                  </w:rPr>
               </w:pPr>
               <w:proofErr w:type="gramStart"/>
               <w:r>
                  <w:rPr>
                     <w:rFonts w:ascii="Times New Roman" w:hAnsi="Times New Roman"/>
                     <w:b/>
                  </w:rPr>
                  <w:t>transmittalLetterDate</w:t>
               </w:r>
               <w:proofErr w:type="gramEnd"/>
            </w:p>
         </w:sdtContent>
      </w:sdt>
      <w:p>
         <w:pPr>
            <w:spacing w:after="0"/>
            <w:rPr>
               <w:rFonts w:ascii="Times New Roman" w:hAnsi="Times New Roman"/>
               <w:highlight w:val="yellow"/>
            </w:rPr>
         </w:pPr>
      </w:p>
      <w:sdt>
         <w:sdtPr>
            <w:rPr>
               <w:rFonts w:ascii="Times New Roman" w:hAnsi="Times New Roman"/>
            </w:rPr>
            <w:tag w:val="adl/granteeName"/>
            <w:id w:val="-885164123"/>
            <w:placeholder>
               <w:docPart w:val="EDCA2E64CFCD4F488D76F03E8327CACD"/>
            </w:placeholder>
            <w:text/>
         </w:sdtPr>
         <w:sdtContent>
            <w:p>
               <w:pPr>
                  <w:spacing w:after="0"/>
                  <w:rPr>
                     <w:rFonts w:ascii="Times New Roman" w:hAnsi="Times New Roman"/>
                  </w:rPr>
               </w:pPr>
               <w:proofErr w:type="gramStart"/>
               <w:r>
                  <w:rPr>
                     <w:rFonts w:ascii="Times New Roman" w:hAnsi="Times New Roman"/>
                  </w:rPr>
                  <w:t>granteeName</w:t>
               </w:r>
               <w:proofErr w:type="gramEnd"/>
            </w:p>
         </w:sdtContent>
      </w:sdt>
      <w:sdt>
         <w:sdtPr>
            <w:rPr>
               <w:rFonts w:ascii="Times New Roman" w:hAnsi="Times New Roman"/>
            </w:rPr>
            <w:tag w:val="adl/granteeAddress"/>
            <w:id w:val="-885164106"/>
            <w:placeholder>
               <w:docPart w:val="EDCA2E64CFCD4F488D76F03E8327CACD"/>
            </w:placeholder>
            <w:text/>
         </w:sdtPr>
         <w:sdtContent>
            <w:p>
               <w:pPr>
                  <w:spacing w:after="0"/>
                  <w:rPr>
                     <w:rFonts w:ascii="Times New Roman" w:hAnsi="Times New Roman"/>
                  </w:rPr>
               </w:pPr>
               <w:proofErr w:type="gramStart"/>
               <w:r>
                  <w:rPr>
                     <w:rFonts w:ascii="Times New Roman" w:hAnsi="Times New Roman"/>
                  </w:rPr>
                  <w:t>granteeAddress</w:t>
               </w:r>
               <w:proofErr w:type="gramEnd"/>
            </w:p>
         </w:sdtContent>
      </w:sdt>
      <w:p>
         <w:pPr>
            <w:spacing w:after="0"/>
            <w:rPr>
               <w:rFonts w:ascii="Times New Roman" w:hAnsi="Times New Roman"/>
            </w:rPr>
         </w:pPr>
         <w:r>
            <w:rPr>
               <w:rFonts w:ascii="Times New Roman" w:hAnsi="Times New Roman"/>
            </w:rPr>
            <w:t xml:space="preserve"/>
         </w:r>
      </w:p>
      <w:p>
         <w:pPr>
            <w:spacing w:after="0"/>
            <w:rPr>
               <w:rFonts w:ascii="Times New Roman" w:hAnsi="Times New Roman"/>
            </w:rPr>
         </w:pPr>
      </w:p>
      <w:p>
         <w:pPr>
            <w:spacing w:after="0"/>
            <w:ind w:left="720"/>
            <w:rPr>
               <w:rFonts w:ascii="Times New Roman" w:hAnsi="Times New Roman"/>
               <w:noProof/>
            </w:rPr>
         </w:pPr>
         <w:r>
            <w:rPr>
               <w:rFonts w:ascii="Times New Roman" w:hAnsi="Times New Roman"/>
               <w:noProof/>
            </w:rPr>
            <w:t>In accordance with 45 CFR 98.66(f), you may request reconsideration by the Assistant Secretary.  A request for reconsideration will not preclude your right to a subsequent appeal.  Your written request for reconsideration by the Assistant Secretary must be made within 30 days of the date of this letter, and must include a copy of this disallowance letter, and be sent to:</w:t>
         </w:r>
      </w:p>
      <w:p>
         <w:pPr>
            <w:spacing w:after="0"/>
            <w:rPr>
               <w:rFonts w:ascii="Times New Roman" w:hAnsi="Times New Roman"/>
            </w:rPr>
         </w:pPr>
      </w:p>
      <w:p>
         <w:pPr>
            <w:spacing w:after="0"/>
            <w:rPr>
               <w:rFonts w:ascii="Times New Roman" w:hAnsi="Times New Roman"/>
            </w:rPr>
         </w:pPr>
      </w:p>
      <w:p>
         <w:pPr>
            <w:spacing w:after="0"/>
            <w:ind w:left="720"/>
            <w:rPr>
               <w:rFonts w:ascii="Times New Roman" w:hAnsi="Times New Roman"/>
               <w:noProof/>
            </w:rPr>
         </w:pPr>
         <w:r>
            <w:rPr>
               <w:rFonts w:ascii="Times New Roman" w:hAnsi="Times New Roman"/>
               <w:noProof/>
            </w:rPr>
            <w:t>In accordance with 45 CFR 98.66(f), you may request reconsideration by the Assistant Secretary.  A request for reconsideration will not preclude your right to a subsequent appeal.  Your written request for reconsideration by the Assistant Secretary must be made within 30 days of the date of this letter, and must include a copy of this disallowance letter, and be sent to:</w:t>
         </w:r>
      </w:p>
      <w:p>
         <w:pPr>
            <w:spacing w:after="0"/>
            <w:rPr>
               <w:rFonts w:ascii="Times New Roman" w:hAnsi="Times New Roman"/>
            </w:rPr>
         </w:pPr>
      </w:p>
      <w:p>
         <w:pPr>
            <w:spacing w:after="0"/>
            <w:rPr>
               <w:rFonts w:ascii="Times New Roman" w:hAnsi="Times New Roman"/>
            </w:rPr>
         </w:pPr>
      </w:p>
      <w:p>
         <w:pPr>
            <w:spacing w:after="0"/>
            <w:rPr>
               <w:rFonts w:ascii="Times New Roman" w:hAnsi="Times New Roman"/>
            </w:rPr>
         </w:pPr>
      </w:p>
      <w:p>
         <w:pPr>
            <w:spacing w:after="0"/>
            <w:ind w:left="720"/>
            <w:rPr>
               <w:rFonts w:ascii="Times New Roman" w:hAnsi="Times New Roman"/>
               <w:noProof/>
            </w:rPr>
         </w:pPr>
         <w:r>
            <w:rPr>
               <w:rFonts w:ascii="Times New Roman" w:hAnsi="Times New Roman"/>
               <w:noProof/>
            </w:rPr>
            <w:t>In accordance with 45 CFR 98.66(f), you may request reconsideration by the Assistant Secretary.  A request for reconsideration will not preclude your right to a subsequent appeal.  Your written request for reconsideration by the Assistant Secretary must be made within 30 days of the date of this letter, and must include a copy of this disallowance letter, and be sent to:</w:t>
         </w:r>
      </w:p>
      <w:p>
         <w:pPr>
            <w:spacing w:after="0"/>
            <w:rPr>
               <w:rFonts w:ascii="Times New Roman" w:hAnsi="Times New Roman"/>
            </w:rPr>
         </w:pPr>
      </w:p>
      <w:p/>
      <w:sectPr>
         <w:pgSz w:w="12240" w:h="15840"/>
         <w:pgMar w:top="1440" w:right="1440" w:bottom="1440" w:left="1440" w:header="720" w:footer="720" w:gutter="0"/>
         <w:cols w:space="720"/>
         <w:docGrid w:linePitch="360"/>
      </w:sectPr>
   </w:body>
</w:document>

Re: new bee trying replace contentControl

PostPosted: Wed Feb 27, 2013 9:25 am
by jason
fachhoch wrote:In the examples all content parts has databinging , but word does not put databinding I have no clue how to add databingind , please advice how to add databinding .


As I explained earlier at docx-java-f6/creating-contentcontrol-t1363.html

See opendope.org,the Getting Started document, or the sub forum.

In summary, there are a couple of tools on codeplex for binding content controls to your XML document.

But docx4j goes further than that, and can use content controls for repeated data, conditional text, and XHTML injection. We call the techniques for doing this the opendope conventions. See the sub-forum for links to authoring tools which are opendope-aware.


Maybe you didn't you see that?

Re: new bee trying replace contentControl

PostPosted: Wed Feb 27, 2013 9:58 am
by fachhoch
I am tring to install OpenDoPE Word Add-In for developers

I am getting this error

docx4j.jpg
docx4j.jpg (71.16 KiB) Viewed 2402 times


Please advice. Also I installed .net 4 framework

Re: new bee trying replace contentControl

PostPosted: Wed Feb 27, 2013 10:08 am
by jason
Try the other/newer authoring add-in, at http://www.opendope.org/downloads/autho ... /setup.exe

Re: new bee trying replace contentControl

PostPosted: Wed Feb 27, 2013 10:27 am
by fachhoch
Thanks a lot for all your support. Installation worked , I open the word but do not find w OpenDoPE menu
where is this menu , please all I have is Template Manager it has submenu about whihc brings

FabDocx Template Author Used under licence from Plutext Pty Ltd

Re: new bee trying replace contentControl

PostPosted: Wed Feb 27, 2013 11:14 am
by jason
That's the one.

You should see a ribbon, and a custom task pane.