Coldfusion 9及CF Roport Builder簡單建立報表的多例

Coldfusin在報表使用上補充JAVA體系在報表方面的不足,俺系統爲

 Window 7;ColdFusion 9 ;IIS 7;ColdFusion Report Builder;ColdFusion Builder;Crystal Report 9;MS SQL 2008 R2

 

安裝 ColdFusion 9 ;ColdFusion Report Builder;ColdFusion Builder等略;

將ColdFusion 9 使用 IIS作爲 Web Server,設置略;

 

俺還沒將ColdFusion 9配上Tomcat

 

1. 設置Coldfusion report builder

   使用CF的RDS,需要設置RDS連接器
local view of webroot:C:/inetpub/wwwroot/CF01/
URL of Webroot:http://localhost:8100/cf01/

 

 

2. 設計報表及預覽

使用報表設計嚮導,類似Crystal Report,設計後可以預覽

 

 


3. Web瀏覽,使用 <CFREPORT>顯示報表

   在CF Builder新建Project,新建.cfm文件,命名爲welcome.cfm,添加如下語句

 

      <CFREPORT format="PDF" template="cfr01.cfr">
      </CFREPORT>

 

 

4. Web瀏覽,使用 動態查詢,<CFREPORT>顯示報表

 

<cfquery name="northwindemployees" datasource="MSSQL2008R2">
  SELECT  TOP 30  id, Yuanbianhao, shebeimingcheng, shebeipinpai, shebeishuliang
  FROM      dbo.Weixiu2
</cfquery>
 
<CFREPORT format="PDF" template="cfr01.cfr" 
    query="#northwindemployees#"/>


 

 

 

5. 使用<cfoutput>標籤輸出報表
<cfdocument format="flashpaper">
            <h1>Employee List</h1>
            <!--- Inline query used for example purposes only. --->
              <cfquery name="EmpList" datasource="MSSQL2008R2">
                  SELECT  TOP 30  id, Yuanbianhao, shebeimingcheng, shebeipinpai
                  FROM dbo.Weixiu2
              </cfquery>
            <cfoutput query="EmpList">
               #EmpList.id#, #EmpList.Yuanbianhao#, #EmpList.shebeimingcheng#,
               #EmpList.shebeipinpai#<br>
            </cfoutput>
     </cfdocument>

 

 

 

6. 水晶報表
   When running on Windows, the cfreport tag also supports the execution of reports created using Crystal Reports version 9 or 10.(Adobe 官方)
  
   運行環境:Windows Xp sp3; Crystal Report 9;IIS5.1; Coldfusion 9
     

   <cfreport report="CR01.rpt">
   </cfreport>

 

 


7. 使用參數動態查詢

 

 

 


編寫.cfm文件

<cfreport template="cfr01.cfr" format="flashpaper">
   <cfreportparam name="paraid" value="8">
</cfreport>

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章