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.
In C1Report, Custom fields derived from Field overrides the GetRenderContent() method. The method's signature in C1FlexReport has been changed to:
public virtual void GetDesignerRenderContent(
ref string text,
ref Image image,
ref bool disposeImage);
If the overriding method sets disposeImage to true, C1FlexReport calls Dispose() on the image after it has been used.
The C1Report.OutlineRootLevel property has been removed. 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.
If a report contains Map custom field(s), it must be generated synchronously (call Render() rather than RenderAsync()), else the map field cannot be displayed in the FlexViewer control. You should set the FlexViewer.UseAsyncRendering property to False.
In C1Report, EndReport event is not fired in case of an error. In FlexReport, the EndReport event is fired even if a fatal error occurs during rendering.
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.
C1Report Render<X> object cannot be used by using following code:
c1Report1.Document.Body.Children.Add(RenderGraphic obj)
This method is not supported in FlexReport.
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’s FieldBase object can no longer be used with FlexReport.
Field is a 'legacy' type with C1FlexReport. Now specialized types are derived from FieldBase in C1FlexReport. Following field objects should be directly created in code-behind:
Use corresponding properties, same as used to be set for C1Report FieldBase object.
CanGrow and CanShrink properties of C1Report have been renamed in C1FlexReport. Use C1FlexReport.AutoHeight, C1FlexReport.AutoWidth, and C1FlexReport.AutoSizeBehavior instead. CanGrow=True and CanShrink=True can be used as C1FlexReport.AutoSizeBehavior.GrowAndShrink.
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.Win.FlexReport.ReportGetScriptObjectEventArgs e)
{
if (e.Name.ToLower() == "lookup")
e.Object = new LookUpObject();
}
C1FlexReport caches rendered content and does not regenerate a report if the report template is not changed. To ensure that report is regenerated, you can call C1FlexReport.SetDirty() method.