原文:发布一快速开发报表的类库,让报表的开发具有前所未有的方便和快速
因大量博友的索要,现与朋友合作封装了使用前文介绍的动态设置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中的显示效果
附上其他报表的显示效果
条形码支持