Creating Custom Fields
You can create your own custom fields and add them to the Report Designer palette. To do that, you have to:
1. Create a custom field class that derives from C1.Win.C1Report.Field.
2. Register your custom field assembly in the Report Designer's settings file.
This is how the Chart and Gradient fields are implemented. The source code for these custom fields is available; you can use it as a starting point to create your own custom fields. The Chart and Gradient fields are registered in the C1ReportDesigner settings file with this entry:
<customfields>
<item value="C1.Win.C1Report.CustomFields;C1.Win.C1Report.CustomFields.Chart" />
<item value="C1.Win.C1Report.CustomFields;C1.Win.C1Report.CustomFields.Gradient" />
</customfields>
For example, to add a new field to the Designer palette, add your control to the <customfields> section in the "C1ReportDesigner.2.exe.settings" file:
<customfields>
<item
value="C1.Win.C1Report.CustomFields.2;C1.Win.C1Report.CustomFields.Chart" />
<item
value="C1.Win.C1Report.CustomFields.2;C1.Win.C1Report.CustomFields.Gradient" />
<!-- THIS LINE WILL ADD A NEW FIELD TO THE DESIGNER -->
<item value="MyCustomFieldAssembly;MyCustomFieldAssembly.MyField" />
</customfields>
This assumes that your field is called "MyField" and it can be found in the assembly called "MyCustomFieldAssembly"
Sample Report Available
For the complete report, see report "12: Custom Fields" in the CommonTasks.xml report definition file, which is available for download from the CommonTasks sample on the ComponentOne HelpCentral Sample page.
|