2010-08-02 2 views
2

데이터베이스에서 Excel 스프레드 시트로 데이터를 내보낼 때 계정 번호가 올바르게 표시되는 데 어려움을 겪고 있습니다. 한 회사의 계좌 번호가 올바르게 표시됩니다. 그러나 다른 사람들은 그렇지 않습니다. 사용자는 전체 계정 번호를 보려면 셀을 두 번 클릭해야합니다. 나는이 문제를 인터넷으로 봤는데 내가 시도한 해결책 중 어느 것도 효과가 없었다.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> 
+0

수출은 어떻게하고 있습니까? CF9 스프레드 시트 기능, HTML (예 : psuedo-excel), ...? – Leigh

+0

<= "센터"일 정렬> ATTUID<일 정렬 = "센터"> 계좌 번호<정렬 일 = " 센터 "> 총 연체 균형<일 정렬 ="센터 ">
회사 명
#는 # totalpastdue # AccountNum4 번호 ## #의 COMPANYNAME 번호를 attuid "returnQuery #dateformat (게시 됨) # #timeformat (게시 됨, "h : mm t t ") #
user281867

+0

다음은 결과입니다. <이름 = "내용 - 처리"값 = cfheader는 "인라인; 파일 이름 = export.xls"> # STEST # user281867

답변

5

계정 번호 앞에 작은 아포스트로피를 삽입 할 수 있습니다. 이것은 수치 (모든) 데이터를 텍스트로 취급하도록 강요합니다.

+0

안녕 벅 보바, 답장을 보내 주셔서 감사합니다. 내일 아침에 너의 제안을 먼저 해 볼게. – user281867

+0

그것은 작동, 당신의 제안 Buckbova 주셔서 감사합니다! – user281867

1

일반적으로 열이 데이터를 표시하기에 충분하지 않을 때 발생합니다. 열을 더 넓게 만들고 문제가 해결되는지 확인하십시오.

+0

안녕 데이브, 나 또한 내일 아침 요청을하려고합니다. 귀하의 회신에 감사드립니다! – user281867

+0

안녕 데이브,이 나를 위해 작동하지 않았다. 귀하의 제안에 감사드립니다. – user281867

7

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

덕분에, 이것은 나를 위해 일했습니다! :) (그리고 아포스트로피 솔루션은하지 않았다) http://stackoverflow.com/questions/6737548/how-can-i-ensure-that-my-excel-cell-will-be-treated-as-a-string – froadie