因大量博友的索要,現與朋友合作封裝了使用前文介紹的動態設置DevExpress Report的組件,這篇文章用來介紹這個ReportCommon自繪報表組件並一些截圖,如果需要請進行購買,郵件中寫上您的郵箱。
聲明:本類庫使用DevExpress控件,但不包含DevExpress控件,因此使用者需要另行購買DevExpress控件,如果使用者因盜版DevExpress控件引起的一切法律糾紛,由使用者自行承擔,本人及相關開發人員蓋不負責。
裝配清單
RptDLL | |
├ ReportCommon.dll | 關鍵DLL |
├ ReportCommon.xml | 注釋 |
├ Util.dll | |
├ FrmReportView | 多組報表顯示窗體組件 |
└ ReportsView | 多組報表顯示可視化組件 |
ReportCommon自繪報表控件說明.doc | 幫助文檔 |
test | Demo項目 |
使用條件
- 本組件基於DevExpress報表控件開發,因此確定您擁有並使用DevExpress這套控件,需要的DevExpress DLL在幫助文檔中有說明;
- 本組件兼容DevExpress9.0及以后的版本,對應8.0及以前的版本可能需要我們修改部分代碼。
功能說明
- 中式報表應該基本能做,有分組統計功能,可以設置各列字體和大小,可以定義頁邊距,可以設定表格數據對齊方式,顯示關閉打印預覽線,可以定義頁眉頁腳,可以添加公司標識等60余項參數定制;
- 各種報表獲取方法:
ShowPreview() 在單獨的窗體顯示報表
ShowPreviewDialog() 在單獨的對話框顯示報表
returnPages() 獲取報表所有Pages
ShowInThisFormPrintsystem()在指定的PrintSystem中顯示報表
GetReport() 獲取繪制完的報表
Demo項目使用的DevExpress DLL
DevExpress.Charts.v11.1.Core.dll |
DevExpress.Data.v11.1.dll |
DevExpress.PivotGrid.v11.1.Core.dll |
DevExpress.Printing.v11.1.Core.dll |
DevExpress.Reports.v11.1.Designer.dll |
DevExpress.Utils.v11.1.dll |
DevExpress.XtraBars.v11.1.dll |
DevExpress.XtraCharts.v11.1.dll |
DevExpress.XtraEditors.v11.1.dll |
DevExpress.XtraPivotGrid.v11.1.dll |
DevExpress.XtraPrinting.v11.1.dll |
DevExpress.XtraReports.v11.1.dll |
DevExpress.XtraReports.v11.1.Extensions.dll |
DevExpress.XtraTreeList.v11.1.dll |
來看看簡單報表是怎么定義的
/// <summary> /// 報表布局數組 /// </summary> private void makeLayoutString() { // 報表主要布局 ReportLayout = new string[][][] { // 報表頭標題布局 new string[][] { // 報表標題 new string[] { "××至××西線高速公路","房建工程清單支付報表" }, // 報表其它頭標題 new string[] { "1", "承包單位", "4" }, new string[] { "2", "合同段", "2" }, new string[] { "3", "填報日期", "2" }, new string[] { "4", "監理單位", "4" }, new string[] { "5", "期號", "2" } , new string[] { "6", "截止日期","2"} }, // 報表明細布局 new string[][] { new string[] { "1", "項目編號", "89" ,"22"}, new string[] { "2", "項目名稱", "200","6" }, new string[] { "3", "c單位", "20" }, new string[] { "4", "r合同數量", "100" }, new string[] { "5", "r單價", "30" }, new string[] { "6", "r變更后數量", "100" }, new string[] { "7", "r本期末完成數量", "100" }, new string[] { "8", "r本期末完成金額","100"}, new string[] { "9", "r上期末完成數量", "100" }, new string[] { "10", "r上期末完成金額", "100" }, new string[] { "11", "r本期完成數量", "70" }, new string[] { "12", "r本期完成金額", "80" }, }, new string[][] { new string[]{"1","承包人","1"}, new string[]{"2","監理處專業工程師","1"}, new string[]{"3","監理處計量工程師","1"}, new string[]{"4","高級駐地","1"}, new string[]{"5","計划部專業工程師","1"}, new string[]{"6","合約部計量工程師","1"} } }; // 報表統計布局(未用) mTotalLayout = new string[][] { new string[]{"小計","289"}, new string[]{"","20"}, new string[]{"","100"}, new string[]{"","30"}, new string[]{"","100"}, new string[]{"","100"}, new string[]{"8","100",DevExpress.XtraReports.UI.SummaryFunc.Sum.ToString()}, new string[]{"","100"}, new string[]{"10","100",DevExpress.XtraReports.UI.SummaryFunc.Sum.ToString()}, new string[]{"","70"}, new string[]{"12","80",DevExpress.XtraReports.UI.SummaryFunc.Sum.ToString()}, }; // 報表分組布局 mGroupLayout = new string[] { "1","dfasdf" }; //報表明細列頭布局 mdetailHeadLayout = new string[][] { new string[] { "項目編號", "89" }, new string[] { "項目名稱", "200" }, new string[] { "單位", "20" }, new string[] { "合同數量", "230" }, new string[] { "到本期末完成", "200" }, new string[] { "到上期末完成", "200" }, new string[] { "本期完成", "150" }, new string[] { "", "89" }, new string[] { "", "200" }, new string[] { "", "20" }, new string[] { "原合同數量", "100" }, new string[] { "單價", "30" }, new string[] { "變更后數量", "100" }, new string[] { "數量", "100" }, new string[] { "金額(元)","100"}, new string[] { "數量", "100" }, new string[] { "金額(元)", "100" }, new string[] { "數量", "70" }, new string[] { "金額(元)", "80" } }; }
再來看看Demo中的顯示效果
附上其他報表的顯示效果
條形碼支持