EngSiong
asked on
Need to prevent numeric data from to default to print as number and print as text
I am using a software called Navision 5.0 which can export data to Excel. The file that is activated is an XSLT file. The problem is that when the data is exported to Excel, all the numeric data that have zeros infront (Example Item No.: 01000) automatically change to 1000.
I do not have any experience with XML or XSLT but I was wondering if there is a way for me to change the logic so that all the numeric data are converted to text.
I do not have any experience with XML or XSLT but I was wondering if there is a way for me to change the logic so that all the numeric data are converted to text.
<Style ss:ID="TextBoxNumber">
<Alignment ss:Horizontal="Right" ss:Vertical="Bottom"/>
<Font ss:FontName="Verdana" x:Family="Swiss"/>
<NumberFormat ss:Format="Standard"/>
</Style>
....
<xsl:attribute name="ss:StyleID">TextBoxNumber</xsl:attribute>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Have some breakthrough on the XSLT code. I manage to change the code to NumberFormat ss:Format="@" The logic should work but I suspect the numbering logic is
Code that I changed but does not affect the output.
<Style ss:ID="TextBoxNumber">
<Alignment ss:Horizontal="Right" ss:Vertical="Bottom" />
<Font ss:FontName="Verdana" x:Family="Swiss"/>
<NumberFormat ss:Format="@"/>
</Style>
----
Code that I suspect is affecting the output
<Data>
<xsl:choose>
<xsl:when test="string(number(translate(@value,',.','11')))!='NaN'">
<xsl:choose>
<xsl:when test="contains(@value,'..')">
<xsl:attribute name="ss:Type">String</xsl:attribute>
<xsl:value-of select="@value"/>
</xsl:when>
<xsl:when test="@value = translate(@value,',.','')">
<xsl:attribute name="ss:Type">Number</xsl:attribute>
<xsl:value-of select="@value"/>
</xsl:when>
<xsl:when test="$DecimalSeparator = '.'">
<xsl:attribute name="ss:Type">Number</xsl:attribute>
<xsl:value-of select="translate(@value,',','')"/>
</xsl:when>
<xsl:when test="$DecimalSeparator = ','">
<xsl:attribute name="ss:Type">Number</xsl:attribute>
<xsl:value-of select="translate(translate(@value,'.',''),',','.')"/>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="ss:Type">Number</xsl:attribute>
<xsl:value-of select="translate(translate(@value,'.',''),',','.')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="ss:Type">String</xsl:attribute>
<xsl:value-of select="@value"/>
</xsl:otherwise>
</xsl:choose>
</Data>
ASKER
Sorry about the incomplete message.
What I meant was
Have some breakthrough on the XSLT code. I manage to change the code to NumberFormat ss:Format="@" The logic should work but I suspect the numbering logic is affected further down the code.
What I meant was
Have some breakthrough on the XSLT code. I manage to change the code to NumberFormat ss:Format="@" The logic should work but I suspect the numbering logic is affected further down the code.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
My snippet are not related because I am only targeting the code that is related to the variable TextBoxNumber.
Any other suggestions while I try to enter the quote marks around the variable?