Share via


Dynamics NAV 5.0 and style sheet issues, tab captions with local characters

Form tab captions that contain country specific characters (for example, Å in Swedish) will be displayed differently in MS Word/Excel, when using local language version of MS Office. For example, if running Nav 5.0 SE version and Customer card the first tab on the card (General) will be displayed as Allmõnt instead of Allmänt when sent to Word (when using local MS Office version).

 

A workaround is suggested here for both Word and Excel. To correct this, a character translation is needed, based on conversion of decimal codes of characters exported. The following example illustrates how this could be corrected.

 

Note, decimal character codes used in this example are character codes for characters õ and ä described in the scenario

õ ansi decimal code 143

ä ansi decimal code 197

and can be found in ANSI character set table referred to at the bottom of the blog. 

For style sheets used for Word documents:

Open the style sheet file in notepad, default file is NavisionFormToWord, placed in Stylesheet folder of the Client folder.

Browse to the following section and replace the section

                        </w:wordDocument>

            </xsl:template>

            <xsl:template name="output-fonts">

with

                        </w:wordDocument>

            </xsl:template>

<xsl:variable name="nbsp1">&#143;</xsl:variable> <!-- this is ANSI code for character as displayed in Word-->

<xsl:variable name="nbsp2">&#197;</xsl:variable> <!-- this is ANSI code for character, as seen on Nav form-->

<xsl:template name="output-fonts">

Then browse to the following section

      <xsl:template match="Control[@type='TabPage']">

find the first occurance of the following line and replace the line

                        <xsl:value-of select="@caption"/>

With

          <xsl:value-of select="translate(@caption,$nbsp1,$nbsp2)"/>

            For style sheets used for Excel documents:

Open the style sheet file in notepad, default file is NavisionFormToExcel, placed in Stylesheet folder of the Client folder.

Browse to the following section and replace the section

  <xsl:variable name="DecimalSeparator" select="Object/DecimalSeparator"/>

   With

  

  <xsl:variable name="DecimalSeparator" select="Object/DecimalSeparator"/>

 <xsl:variable name="nbsp1">&#143;</xsl:variable>

 <xsl:variable name="nbsp2">&#197;</xsl:variable>

  Then browse to the following section and replace the section

           

<xsl:template match="Control[@type='TabPage']">

            <Worksheet xmlns="urn:schemas-microsoft-com:office:spreadsheet">

                                    <xsl:attribute name="ss:Name">

                                                <xsl:value-of select="@caption"/>

                                    </xsl:attribute>

with

<xsl:template match="Control[@type='TabPage']">

<Worksheet xmlns="urn:schemas-microsoft-com:office:spreadsheet">

            <xsl:attribute name="ss:Name">

                        <xsl:value-of select="translate(@caption,$nbsp1,$nbsp2)"/>

            </xsl:attribute>

Finally, find the following section and replace the section

<Cell ss:StyleID="tabCaption">
<Data ss:Type="String">
<xsl:value-of select="@caption"/>
</Data>
</Cell>

With

<Cell ss:StyleID="tabCaption">
<Data ss:Type="String">

<xsl:value-of select="translate(@caption,$nbsp1,$nbsp2)"/>

</Data>
</Cell>

*************************************************************

Note that a variable can be added for each character this applies to.

So to correct 2 such characters one can for example add 4 variables (one for ansi code of each character as shown in Nav and Office).

 <xsl:variable name="nbsp1">&#247;</xsl:variable>

 <xsl:variable name="nbsp2">&#246;</xsl:variable>

 <xsl:variable name="nbsp3">&#143;</xsl:variable>

 <xsl:variable name="nbsp4">&#197;</xsl:variable>

And translate functions can be nested, so the line

                        <xsl:value-of select="@caption"/>

is then replaced with

  <xsl:value-of select="translate(translate(@caption,$nbsp1,$nbsp2),$nbsp3,$nbsp4)"/>

The following link contains character table for ANSI.

            https://msdn2.microsoft.com/en-us/library/aa771694.aspx

            ************************************************************************

 

Jasminka Vukovic

Microsoft Dynamics NO
Microsoft Customer Service and Support (CSS) EMEA

These postings are provided "AS IS" with no warranties and confer no rights. You assume all risk for your use.