目前已经有用户开始使用FlexReport来替换C1Report。
从2016年3月开始,C1Report进行了维护模式,即继续支持但不在更新。
我们就来介绍C1Reports转换成FlexReport方法。
在上一篇文章中:C1Reports转换成FlexReport(1)。我们已经介绍了两种,现在就来介绍第三种。
3.更新已有的C1Report工程
在VisualStudio项目中更新C1Report工程到FlexReport工程。
步骤:
1.打开已有包含C1Report(.xml)文件的工程。
2.从窗体中删除C1Report。
3.从窗体中删除C1Report相关的C1PrintPreview 或是C1RibbonPreviewControl
4.在工具箱添加C1FlexReport.
需要使用的引用:C1.Win.FlexReport.4.dll
有关在工具箱添加控件,可以参考我们的产品博客:添加C1引用和控件
5.添加C1FlexView控件到工具箱。
需要使用的引用:C1.Win.FlexViewer.4.dll
有关在工具箱添加控件,可以参考我们的产品博客:添加C1引用和控件
6.在窗体上放一个C1FlexReport。
在引用中会添加如下dlls:
- C1.C1Pdf.4
- C1.Win.4
- C1.Win.BarCode.4
- C1.Win.C1Document.4
- C1.Win.FlexReport.4
- 这些引用会是相同的版块。
- 7.在窗体上放一个C1FlexViewer控件。
- C1.C1Zip.4
- C1.Win.C1DX.4
- C1.Win.C1Ribbon.4
- C1.Win.FlexViewer.4
- C1.Win.ImportServices.4
8.添加如下的引用:
- C1.C1Rtf.4
- C1.C1Excel.4
- C1.Win.C1Chart.4
- C1.Win.C1Chart3D.4
如果使用map或是super-label的自定义fields,添加如下引用:
- C1.Win.FlexReport.CustomFields.4
- C1.WPF.Maps.4
- C1.WPF.4
9.将C1Report重新命名为C1FlexReport。
在代码中的更改如下:
- http://helpcentral.componentone.com/nethelp/FlexReport/UpgradingC1ReporttoC1FlexReport.htm
Dim report As New C1Report() 'To Dim report As New C1FlexReport()
- http://helpcentral.componentone.com/nethelp/FlexReport/UpgradingC1ReporttoC1FlexReport.htm
C1Report report = new C1Report(); //To C1FlexReport report = new C1FlexReport();
10.改变命名空间(C1.C1Report变成C1.Win.FlexReport)。
11.删除C1Report相关的引用和依赖:C1.C1Report, C1.Win.C1Report, C1.Win.C1Barcode, 和C1.Win.C1RibbonPreview.
12.删除命名空间:C1.Win.C1Preview.
13.在licenses.licx文件中删除C1Report 相关的license入口和viewer(C1Preview 或是C1RibbonPreview)
14.为了将C1FlexReport 和C1FlexViewer绑定,要改变如下的代码:
- http://helpcentral.componentone.com/nethelp/FlexReport/UpgradingC1ReporttoC1FlexReport.htm
Dim c1r As C1.C1Report.C1Report = New C1Report() c1r.Load(filepath, reportname) C1PrintPreviewControl1.Document = clr 'To Dim report As New C1FlexReport() report.Load(filepath, reportname) C1FlexViewer1.DocumentSource = report
C1.C1Report.C1Report c1r = new C1Report(); c1r.Load(filepath, reportname); c1PrintPreviewControl1.Document=clr; //To C1FlexReport report = new C1FlexReport(); report.Load(filepath, reportname); c1FlexViewer1.DocumentSource = report;
现在就可以通过C1FlexViewer控件展示FlexReport。
C1FlexViewer控件和C1PrintPreviewControl ,C1RibbonPreviewControl不兼容。
更多资源
C1FlexReport for Winform中文帮助文档地址:
http://helpcentral.componentone.com/nethelp/FlexReport/C1.Win.FlexReport.4~C1.Win.FlexReport.C1FlexReport.htm
如果你对C1FlexReport感兴趣,请到我们的官网下载最新版本:/download/?pid=3
如果你有疑问,可以到GCDN论坛获得技术支持:http://gcdn.grapecity.com.cn/showforum-68.html