Zip code discards leading zero when displayed on excel. Export to Excel to convert XML to XSLT

I export data from vb.net to excel, and it discards the initial zero when it maps to excel. How can I avoid dropping the initial zero? I read the decision to add a single quote, but that makes my Excel column excellent. Users will also complain if they see a single quote in a zip code field. vb.net code

Response.AddHeader("content-disposition", attachment)
        Response.ContentType = "application/vnd.ms-excel"
        Response.Charset = ""

the stored procedure outputs XML and is converted using XSLT before being displayed on EXCEL

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template match="/">
    <HTML>
      <HEAD>
        <STYLE type="text/css"> TABLE{table-layout: automatic; width:100%} .tblHeader{background-color:RGB(192,192,192);font-weight:bold} .row1{background-color:RGB(204,204,255)} .row2{background-color:RGB(153,204,255)} </STYLE>
      </HEAD>
      <BODY>
        <TABLE border="1">

          <THEAD>
            <tr class="tblHeader">
              <xsl:for-each select="*/*[1]/*">
                <td>
                  <xsl:value-of select="."/>
                </td>
              </xsl:for-each>
            </tr>
          </THEAD>

          <TBODY>
            <xsl:for-each select="ClientArray/Client">
              <TR>

                <xsl:for-each select="*">
                  <TD>
                    <xsl:value-of select="."/>
                  </TD>
                </xsl:for-each>

              </TR>
            </xsl:for-each>

          </TBODY>
        </TABLE>
      </BODY>
    </HTML>

  </xsl:template>
</xsl:stylesheet>

, , excel (/) .. , - excel,   excel -, . excel

+3
5

Excel . , [ ].

Excel Interop, , , , .

+1

<TD style="mso-number-format:\@;">

Leading zeros.

+1

Excel PHP. , zip Excel .

vb.net, PHP, :

echo '="' . $the_zip_code . '"';
+1

, . , . , .

-2

Source: https://habr.com/ru/post/1759970/


All Articles