导出到 Excel 无法正确显示数字 [英] Export to Excel not displaying numbers correctly

查看:15
本文介绍了导出到 Excel 无法正确显示数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm having a hard time getting account numbers to display correctly when exporting data from database to an Excel spreadsheet. The account number for one company, shows up correctly. However, others don't. Users have to double click in the cell to see the whole account number. I have Googled this issue and none of the solutions that I've tried worked.

<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> 

推荐答案

您可以在帐号前插入撇号'.这将强制 excel 将数字(任何)数据视为文本.

You can insert an apostrophe ' preceding the account number. This will force excel to treat numeric (any) data as text.

这篇关于导出到 Excel 无法正确显示数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆