使用C1Report创建的报告与C1FlexReport完全兼容 。以下是将现有C1Report报告定义(.xml)升级或转换为C1FlexReport报告定义(.flxr)的两种简单方法:
1.在设计器中升级定义的C1Report报表
- 运行C1FlexReportDesigner.4.exe。
- 转到“ 文件” |“打开”,然后选择要升级的C1Report报告定义(.xml)。您将看到以下对话框:
- 单击确定。
- 转到文件|保存。
- 在“ 保存报告定义文件”对话框中,指定文件名,然后单击“ 保存”。
报告定义被保存为.flxr类型。您的报表定义现在已从C1Report的.xml转换为C1FlexReport的.flxr。
2.在Visual Studio中将现有的C1Report Windows应用程序项目升级到FlexReport Windows应用程序项目
- 打开现有的Windows应用程序项目,其中包含C1Report(.xml)文件。
- 从表单中删除C1Report。
- 从窗体中删除C1Report的预览控件C1PrintPreview或C1RibbonPreviewControl。
- 将C1FlexReport组件添加到工具箱(正常安装时不需要):
- 右键单击选项卡,然后选择“选择项目...”,将显示“选择工具箱项目”对话框。
- 单击浏览,然后从bin \ v4.0文件夹中选择C1.Win.FlexReport.4.dll。该C1FlexReport组件将在工具箱中添加。
- 将FlexViewer控件添加到工具箱(正常安装时不需要):
- 右键单击选项卡,然后选择“选择项目...”,将显示“选择工具箱项目”对话框。
- 单击浏览,然后从bin \ v4.0文件夹中选择 C1.Win.FlexViewer.4.dll。FlexViewer控件将添加到“ 工具箱”中。
- 将C1FlexReport放到窗体上。与C1FlexReport版本相同的以下dll需要添加到引用中:
- C1.C1Pdf.4
- C1.Win.4
- C1.Win.BarCode.4
- C1.Win.C1Document.4
- C1.Win.FlexReport.4
- 将FlexViewer控件放在窗体上。与C1FlexViewer版本相同的以下dll应添加到引用中:
- C1.C1Zip.4
- C1.Win.C1DX.4
- C1.Win.C1Ribbon.4
- C1.Win.FlexViewer.4
- C1.Win.ImportServices.4
- 将以下dll添加到引用中:
- C1.C1Word.4
- C1.C1Excel.4
- C1.Win.C1Chart.4
- C1.Win.C1Chart3D.4
要使用地图和超级标签自定义字段,请将以下dll添加到引用中:- C1.Win.FlexReport.CustomFields.4
- C1.WPF.Maps.4
- C1.WPF.4
将C1Report组件重命名为C1FlexReport组件。在代码中,您可以按以下方式更改组件的名称:
将CSC1Report report = new C1Report();
变为
CSC1FlexReport report = new C1FlexReport();
- 在后台代码中,将名称空间的名称从C1.C1Report更改为C1.Win.FlexReport。
- 删除所有对C1Report及其依赖项的dll的引用-C1.C1Report,C1.Win.C1Report,C1.Win.C1Barcode和C1.Win.C1RibbonPreview。
- 删除命名空间C1.Win.C1Preview。
- 从licenses.licx中删除整个C1Report和引用的查看器(C1Preview或C1RibbonPreview)的许可证。
为了将C1FlexReport与C1FlexViewer绑定,必须更改以下代码:
将
CSCC1.C1Report.C1Report c1r = new C1Report(); c1r.Load(filepath, reportname); c1PrintPreviewControl1.Document=clr;
变为CSC1FlexReport report = new C1FlexReport(); report.Load(filepath, reportname); c1FlexViewer1.DocumentSource = report;
请注意,只能通过使用FlexViewer控件在运行时预览FlexReport。FlexViewer控件与C1PrintPreviewControl或C1RibbonPreviewControl不兼容。
