Support for C1Report in FlexReport > C1Report to FlexReport Breaking Changes |
FlexReport code has been written from scratch; as a result, you will find following breaking changes in the API on migrating from C1Report to FlexReport:
In FlexReport, there is a separate dedicated report-level collection C1FlexReport.Parameters, where the report parameters can be specified. When importing a C1Report report definition from a .xml file, any parameters specified old-style using PARAMETERS keyword are automatically added to the C1FlexReport.Parameters collection.
In FlexReport, the OnOpen script is fired AFTER the data source has been opened, so any changes to the main data source made in that script does not affect the report. In order to change something in the data source before the report is generated, use GlobalScripts. GlobalScripts can contain function and procedure definitions, and codes that are not within these definitions; all such definitions and codes are now executed when the report starts rendering, before the data source is opened.
The C1Report.OutlineRootLevel property has been removed in FlexReport. To control the outline structure, use properties OutlineLabel and OutlineParent. To turn off outlines generated by a subreport, use the SubreportField.OutlinesVisible property.
In C1Report, there are two slightly different methods to generate/layout text - default and 'gdi+' (if
C1Report.UseGdiPlusTextRendering were set to true - non-default). These methods can produce slightly different text layouts, e.g. line breaks could be in different places etc. FlexReport always generates/lays out text like C1Report with UseGdiPlusTextRendering set, but still there may be differences in line breaks between C1Report with UseGdiPlusTextRendering set, and FlexReport.
The AddOutlineEntry event has been removed. To change the text of the outline entry generated by a field/section/sub-section, use the OutlineLabel property.
A new specialized event type has been added for the C1FlexReport.ReportError event: ReportErrorEventHandler, accepting ReportErrorEventArgs event arguments. The ReportEventArgs type has been modified - Exception and Handled have been removed from the event arguments.
Following C1Report methods/properties have been removed from C1FlexReport:
C1Report Render<X> method cannot be accessed in code behind with C1FlexReport. These methods are for internal use.
C1FlexReport.Document cannot be converted to System.Drawing.Printing.PrintDocument. PrintDocument should not be used with FlexReport since PrintDocument's C1Report.Document property does not exist.
In FlexReport, IC1FlexReportRecordset does not have ApplyFilter() and ApplySort() methods. Instead, DataSource in FlexReport has filters/sort definition, so these should be used. IC1FlexReportRecordset is assigned to DataSource.Recordset while filters/sorts can be defined on the DataSource.
C1Report uses single "Field" class to represent various content in the report. Whereas, C1FlexReport uses different classes: TextField, BarCodeField, RtfField, SubreportField, RtfField, CheckBoxField, ImageField, ShapeField, ChartField etc. It also contains Field class same as in C1Report but it is obsolete and used only for backward compatibility.
In FlexReport, instead of the AddScriptObject event there is GetScriptObject event. So in this case, instead of
private void c1flxr_StartReport(object sender, System.EventArgs e)
{
c1flxr.AddScriptObject("LookUp", new LookUpObject());
}
this works:
c1flxr.GetScriptObject += c1flxr_GetScriptObject;
...
void c1flxr_GetScriptObject
(object sender, C1.WPF.FlexReport.ReportGetScriptObjectEventArgs e)
{
if (e.Name.ToLower() == "lookup")
e.Object = new LookUpObject();
}