Export of Pictures using Send-To MS Word/Excel functionality

Export of Pictures using Send-To MS Word/Excel functionality

  • Comments 3

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

 

 

Leave a Comment
  • Please add 8 and 5 and type the answer here:
  • Post
  • Hi!

    Where can I get more information about the new picture box export-possibilities? Unfortunately there's almost nothing about it in the what's new document...

    Thanks and best regards,

    HL

  • Sorry about late reply, I haven't seen this comment before.

    There is really no documentation regarding this that I know of, other then what's already there. The only change is really that client now supports picture box control when using send-to functionality, so any picture shown on a form using a picture box will automatically be exported. You can see the data client exports (other then obviously checking the resulting document) by adding this line to codeunit 403, trigger LaunchApp:

    ...

    AddLocaleInfo(DataXML);

    DataXML.transformNodeToObject(StylesheetXML,ApplicationXML);

    DataXML.save(<a path to temp data.xml file locally>);   //ADD THIS LINE

    ...

    When using classic client to export data to word/excel, this line will save generated data xml output file in the path specified locally. That will give you the chance to review how output of a picture box control looks like.

    Don't know if this is of any help, but if you have any specific questions or issues regarding this, let me know.

  • Hello,

    Is it possible that this is not fixed in NAV 2009 SP1 ?

    When I open the company information page in NAV 2009 (with picture box on it), and send-to word , there is no picture shown in the style sheet output.

    Is the update only for 5.0 SP1 ?

    Thx,

Page 1 of 1 (3 items)