We always had the functionality to export the report contents to HTML file format and view them in a web browser. We have patiently anticipated functionality of rendering HTML formatted text within a report.
With the release of 11V1 version of the C1Report controls, a new field type has been added to the ReportDesigner tool, the SuperLabel field. The SuperLabelcontrol has been a part of the SuperTooltip control for a long time, and it has the capability of rendering almost all the HTML tags. Now, it is available as a field within the report, just like the C1Chart field.
In other words, you are now able to render HTML formatted text as simply as RTF text in a report field.
There are some restrictions though; this field is only available for now in the 4.0 version of the ReportDesigner. It would require the use of the 4.0 versions of the respective controls and scaling the application to 4.0 framework (if this feature is to be made use of).
The field can be added to an existing report as well, by opening it in the ReportDesigner application and adding the field to the desired section, just like any other label or text field.
Preview of the report:
Addition through code also remains the same, as it is for any other Report field. For this field to be used we would be required to build the latest "CustomFields", sample using 4.0 build of C1Report. As for the latest changes there is now no need to reference the C1Chart and C1SuperTool tip controls, these are picked dynamically. This also makes having some of the same versions unnecessary, which were used to create the CustomFields dll, as was with the previous releases.
Once the C1.C1Report.CustomFields.4.dll is available, we can reference it in the new project, add-drop a C1Report control, and load an existing report using the C1Report.Load() method.
C1.C1Report.CustomFields.SuperLabel slfield = new C1.C1Report.CustomFields.SuperLabel(); slfield.Text = "**_Test_"; slfield.Height = 740; slfield.Width = 2960; slfield.BorderColor = Color.Black; slfield.BorderStyle = C1.C1Report.BorderStyleEnum.Solid; c1Report1.Sections["Detail"].Fields.Add(slfield);**
Adding of the SuperLabel field can be done using the following code, The above code would add a field to report and render a bold and italic text "Test" in the preview. As shown in the image below,
In conclusion, we havenow officially seen how to render HTML text in a C1Report, both from the ReportDesigner and through code at run time.