With release of update 2 for NAV 5.0 SP1, the client now supports exporting picture box using style sheets (send-to Word/Excel) functionality.
Both Client and style sheets have been modified to align with this change. If you don’t normally have picture fields on the form you’re exporting, you would add the field through codeunit 403, where additional data is normally added to the export (runtime). For simplicity I added a PictureBox contatining Picture field to Item form – and that is all there is to it really. When using send-to functionality, generated output will show item picture in the document. Now testing this with export to Word, one might note the crossed icon if the picture is not available. Though that should not be an issue either, modifying the style sheet to ignore the control if data is not present, should this really be necessarry, is as simple as a single if-test.
So to illustrate this, I’ve changed the following part of NavisionFormToWord style sheet (changed lines marked with comments), to add an if test around ‘pict’- tag, and
<xsl:if test=”@data != ””> <!– IF TEST BEGIN !–>
<w:pict>
<w:binData xml:space=”preserve”><xsl:attribute name=”w:name”>wordml://<xsl:value-of select=”@id”/>.png</xsl:attribute><xsl:value-of select=”@data”/></w:binData>
<v:shape id=”_x0000_i1025″ type=”#_x0000_t75″>
<v:imagedata o:title=”CRONUS”>
<xsl:attribute name=”src”>wordml://<xsl:value-of select=”@id” />.png</xsl:attribute>
<xsl:attribute name=”o:title”><xsl:value-of select=”@name” /></xsl:attribute>
</v:imagedata>
</v:shape>
</w:pict>
</xsl:if> <!– IF TEST END !–>
Note that this is even easier if we’re controling field export through coudeunit 403, where this test can be implemented instead, to control availability of the control based on data content.
Jasminka Thunes
Microsoft Norway
Microsoft Customer Service and Support (CSS) EMEA