Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/image-processing/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
导出到Excel无法正确显示数字_Excel_Coldfusion_Export To Excel_Coldfusion 8 - Fatal编程技术网

导出到Excel无法正确显示数字

导出到Excel无法正确显示数字,excel,coldfusion,export-to-excel,coldfusion-8,Excel,Coldfusion,Export To Excel,Coldfusion 8,在将数据从数据库导出到Excel电子表格时,我很难正确显示帐号。一家公司的帐号显示正确。然而,其他人则不然。用户必须双击单元格才能看到整个帐号。我在谷歌上搜索过这个问题,但我尝试过的解决方案都不起作用 <cfsetting enablecfoutputonly="Yes"> <cfsavecontent variable="sTest"> <cfoutput> <table> <tr>&l

在将数据从数据库导出到Excel电子表格时,我很难正确显示帐号。一家公司的帐号显示正确。然而,其他人则不然。用户必须双击单元格才能看到整个帐号。我在谷歌上搜索过这个问题,但我尝试过的解决方案都不起作用

<cfsetting enablecfoutputonly="Yes">
   <cfsavecontent variable="sTest">
       <cfoutput>
       <table>
       <tr><th align="center">ATTUID</th>
           <th>Company Name</th>
           <th align="center">Account Number </th>
           <th align="center">Total Past Due Balance</th>
           <th align="center">Date Sent</th>
      </tr>
      <cfloop query="returnQuery">
          <tr><td>#attuid#</td>
              <td>#companyname#</‌​td>
              <td>#AccountNum4#‌​</td>
              <td>#totalpastd‌​ue#</td>
              <td>#datefor‌​mat(posted)# #timeformat(posted, "h:mm tt")#</td> 
          </tr>
      </cfloop>
      </table>
  </cfoutput>
</cfsavecontent>
<cfcontent type="application/vnd.msexcel"> 
<cfheader name="Content-Disposition" value="inline; filename=export.xls">  
<cfoutput>#sTest#</cfoutput> 

阿图德
公司名称
帐号
逾期余额总额
发送日期
#阿图德#
#公司名称#
#账户编号4#‌​
#全食‌​ue#
#日期‌​mat(已发布)##timeformat(已发布,“h:mm tt”)#
#斯特斯特#

当列的宽度不足以显示数据时,通常会发生这种情况。尝试将列加宽,看看这是否能解决问题。

您可以在账号前插入撇号。这将迫使excel将数字(任何)数据视为文本。

如果要导出html,还可以使用xml mso架构属性将数字格式化为文本,而无需更改实际单元格值,即添加撇号

<cfheader name="Content-Disposition" value="inline; filename=someFile.xls"> 
<cfcontent type="application/vnd.ms-excel">
<html xmlns:o="urn:schemas-microsoft-com:office:office"
    xmlns:x="urn:schemas-microsoft-com:office:excel"
    xmlns="http://www.w3.org/TR/REC-html40">
<body>
<table>
 <tr>
  <td style='mso-number-format:"\@";'>510074123456989</td>
 </tr>
</table>
</body>
</html>

510074123456989

buckbova你好,感谢您的回复。我明天早上第一件事就是试试你的建议。嗨,戴夫,我明天早上也会试试你的要求。谢谢你的回复!你的出口情况如何?使用CF9电子表格功能,html(即psuedo excel)?ATTUIDCompany NAME账号逾期余额总额发送日期35; attuid##公司名称##AccountNum4##总到期日#日期格式##时间格式#发布,“h:mm tt”)#以下是输出#sTest#谢谢,这对我很有用!:)(撇号解决方案没有)