InfoPath Image to WordML - InfoPath Dev
in

InfoPath Dev

InfoPath Image to WordML

Last post 04-06-2006 02:29 PM by Anonymous. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 03-29-2006 02:08 PM

    InfoPath Image to WordML

    Hi:

    I have an InfoPath form that can have images attached. The form's main data source is XML--data is stored with the form. I have an XSL that I created using the Microsoft WML2XSLT tool. Everything in the InfoPath form comes through except, of course, the image. I just get a chunk of base64. Does anyone know how to modify an XSL file to decode the base64? I have been trying to do something with the example shown here http://blogs.3sharp.com/Blog/davidg/archive/2005/11/08/978.aspx but I am just not getting it. Any help/suggestions/samples would be greatly appreciated--I'm stuck!!
  • 03-30-2006 10:59 PM In reply to

    Re: InfoPath Image to WordML

    Hi,

    me I do like this:

    <w:pict>
    <w:binData w:name="wordml://02000001.jpg">
    /9j/4AAQSkZJRgABAgEBLAEsAAD/7RGMUGhvdG9zaG9wIDMuMAA4QklN
    ... picture in base64 code...
    A+0KUmVzb2x1dGlvbgAA//Z
    </w:binData>
    <v:shape style="width:36pt;height:43.5pt">
    <v:imagedata src="wordml://02000001.jpg"/>
    </v:shape>
    </w:pict>


    ++

    Thierry
    Infopath 2007, Langage: C#2.0 (Modèle Objet 2003)
    merci de lire ceci
  • 03-31-2006 07:47 AM In reply to

    Re: InfoPath Image to WordML

    Which is great for a single image. My problem is that the user can insert one or more images and I then need to have those images display in a WordML transform.....so I need to pull over the node with the base64 from the XML....
  • 04-06-2006 02:29 PM In reply to

    Re: InfoPath Image to WordML

    Okay, I have something going that is working nicely. Here is the gist of it.

    Schema looks like this:

    my:Fields
    my:Group
    my:field
    my:row


    my:Group is a repeating group. my:field is a picture file. my:row has a default value of count(../preceding-sibling::my:Group)+1. This means that for a given InfoPath form, each row element is a different number.

    In my WordML XSL file, I have a template that looks like this:
    <xsl:template match="/ns0:myFields/ns0:Group1">
    <ns0:Group1>
    <xsl:for-each select="@ns0:*|@*[namespace-uri()='']">
    <xsl:attribute name="{name()}" namespace="{namespace-uri()}">
    <xsl:value-of select="." />
    </xsl:attribute>
    </xsl:for-each>
    <w:tbl>
    <w:tblPr>
    <w:tblStyle w:val="TableGrid" />
    <w:tblW w:w="0" w:type="auto" />
    <w:tblLook w:val="01E0" />
    </w:tblPr>
    <w:tblGrid>
    <w:gridCol w:w="4428" />
    <w:gridCol w:w="4428" />
    </w:tblGrid>
    <w:tr>
    <w:tc>
    <w:tcPr>
    <w:tcW w:w="4428" w:type="dxa" />
    </w:tcPr>
    <w:p>
    <w:r>
    <w:pict>
    <w:binData>
    <xsl:attribute name="w:name">wordml://<xsl:value-of select="./ns0:row"/></xsl:attribute>
    <xsl:value-of select="./ns0:field2" />
    </w:binData>
    <v:shape id="_x0000_i1025" type="#_x0000_t75" style="width:100pt;height:50.25pt">
    <v:imagedata>
    <xsl:attribute name="src">wordml://<xsl:value-of select="./ns0:row"/></xsl:attribute>
    </v:imagedata>
    </v:shape>
    </w:pict>
    </w:r>
    </w:p>
    </w:tc>
    </w:tr>
    </w:tbl>
    </ns0:Group1>
    </xsl:template>

    Since I generated the XSL using the WML2XSLT.exe by Microsoft, the XSL is a bit busier than it needs to be, but I only modified the center bits, where I need the picture element to repeat. What happens is exactly like what is demo'd in the blog I have linked to in my first post--the row element acts as part of the name attribute for the binData and again as part of the name attribute for the imagedata. Since the row element is always incremented by 1, the name stays unique. All I had to do was <xsl:apply-templates select="/ns0:myFields/ns0:Group1"/> at the point in my WordML XSL that I wanted my table with my pics.

    Hope this saves anyone else struggling with this some time, and kudos and thanks to David Gerhardt for his blog entry, samples and suggestions.
Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.