Welcome to OpenXML Developer Sign in | Join | Help

How can I integrate InfoPath Xhtml into WordML

Last post 04-07-2008, 12:11 AM by spxl. 6 replies.
Sort Posts: Previous Next
  •  03-23-2006, 9:36 AM 62

    How can I integrate InfoPath Xhtml into WordML

    Hi

     

    I am building a word document from scratch using an XML writer; let’s say a very simple word document that will be used as a report.

     

    I’ve injected all the contents to the xml stream as WordML, everything is fine by now, until the point I wanted to Write some contents produced by InfoPath’s XHTML filed.

     

    How can I add this to the WordML?

     

    Can I say something similar to this?

    <!--The word ml paragraph -->

    <w:p> 

              <!-- The Xhml contents -->

              <div> …. </div>

    </w:p>

     

    And if I can’t, how can I use Microsoft Office InfoPath to gather the data, and Microsoft Office Word to generate the reports from the data, if XHTML is not understood between both Microsoft Office Applications?

  •  03-23-2006, 10:14 AM 63 in reply to 62

    Re: How can I integrate InfoPath Xhtml into WordML

    Hey G.T.,

    That's a scenario we really wanted to nail in Word 2007. In Word 2003, we had an element called cfChunk which allowed you to embed a chunk of wordprocessingML that had it's own style definitions so that you didn't have to worry about managing conflicts with the rest of the document. When Word opened the file, we would take care of merging everything (it's almost like giving us a mini document and telling us to paste it on open).

    In Word 2007, we have taken that concept further with a new feature we call the "alternative format chunk". You can take RTF, HTML, WordML, or even the binary format and store that as a seperate part in the ZIP package. Then you just put an afChunk tag into the main body of the document where you want that part to go, and we'll merge it into the file on open. This means that any of those XHTML chunks you have from InfoPath can just be thrown into the package, and as long as you properly reference them, we'll merge them with the rest of the file on open.

    -Brian

  •  03-29-2006, 7:10 PM 119 in reply to 63

    Re: How can I integrate InfoPath Xhtml into WordML

    Nice.
  •  04-04-2006, 4:19 AM 138 in reply to 119

    Re: How can I integrate InfoPath Xhtml into WordML

    It should be really easy to add an XML file into the document which acrs as a sub part for the document. follow the steps shown below


    Step 1 . Create document.xml.rels the content as shown below. It will contain a relationship node whose "Target" attribute is set to "Fragment1.xml"

    FileStart ------------------------------------------------

    <?xml version="1.0" encoding="utf-8" standalone="yes"?>
    <Relationships xmlns="http://schemas.microsoft.com/package/2005/06/relationships">
        <Relationship Id="rId1"
        Type="http://schemas.microsoft.com/office/2006/relationships/wordAFChunk"
        Target="Fragment1.xml" />
    </Relationships>

    FileEnd ------------------------------------------------

    Step 2. Create a Fragment1.xml
    FileStart ------------------------------------------------

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <?mso-application progid="Word.Document"?>
    <w:wordDocument xmlns:aml="http://schemas.microsoft.com/aml/2001/core"
      xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
      xmlns:wdr="http://schemas.microsoft.com/office/officeart/2005/8/wddr"
      xmlns:ve="http://schemas.microsoft.com/winfx/2005/06/markup-compatibility"
      xmlns:o="urn:schemas-microsoft-com:office:office"
      xmlns:o12="http://schemas.microsoft.com/office/2004/7/core"
      xmlns:m="http://schemas.microsoft.com/office/omml/2004/12/core"
      xmlns:r="http://schemas.microsoft.com/office/2005/11/relationships"
      xmlns:w10="urn:schemas-microsoft-com:office:word"
      xmlns:v="urn:schemas-microsoft-com:vml"
      xmlns:w12="http://schemas.microsoft.com/office/word/2005/10/wordml"
      xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint"
      xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml"
      xmlns:wsp="http://schemas.microsoft.com/office/word/2003/wordml/sp2"
      xmlns:sl="http://schemas.microsoft.com/schemaLibrary/2003/core"
      w:macrosPresent="no" w:embeddedObjPresent="no" w:ocxPresent="no">
     <w:body>
      <w:p wsp:rsidR="001B7052" wsp:rsidRPr="00301844" wsp:rsidRDefault="00301844">
       <w:r wsp:rsidRPr="00301844">
        <w:t>The text you want goes here</w:t>
       </w:r>
      </w:p>
     </w:body>
    </w:wordDocument>

    FileEnd ------------------------------------------------


    Step 3. Create the main part Document.xml, but remember to user the relationship "rId1
     you created for the Fragment1.xml

    FileStart ------------------------------------------------

    <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
      <w:wordDocument xmlns:w="http://schemas.microsoft.com/office/word/2005/10/wordml"
        xmlns:v="urn:schemas-microsoft-com:vml"
        xmlns:r="http://schemas.microsoft.com/office/2005/11/relationships">
        <w:body>
           <w:p>
              <w:r>
                 <w:t>Main Document content goes here</w:t>
              </w:r>
           </w:p>
            <w:altChunk r:id="rId1" />
      </w:body>
      </w:wordDocument>

    FileEnd ------------------------------------------------

     

    Add the [Content_type].xml

    Zip it and open it in Office 12.

    and you will see your content from the Fragment1.XML

  •  02-12-2007, 3:28 PM 1203 in reply to 138

    Re: How can I integrate InfoPath Xhtml into WordML

    Does this work with MS word2003?

  •  02-13-2007, 2:38 AM 1205 in reply to 1203

    Re: How can I integrate InfoPath Xhtml into WordML

    This link would probably answer your question,

    http://msdn2.microsoft.com/en-us/library/aa223574(office.11).aspx

  •  04-07-2008, 12:11 AM 3003 in reply to 1203

    Re: How can I integrate InfoPath Xhtml into WordML

    I don't think the <altChunk> element is supported at all for Word 2003, even with the Word 2007 file format compatibility pack. At least an <altChunk> pointing to an HTML chunk is not supported.

    This includes the current Word Viewer (with the 2007 file format compatibility pack).

    -spxl
View as RSS news feed in XML