ActiveReports 6 Online Help
Load a File into a RichText Control
Show AllShow All
Hide AllHide All

You can load an RTF file or an HTML file into the ActiveReports RichText control at run time.

Caution: Do not attempt to load a file into a RichTextBox in a section that repeats. After the first iteration of the section, the RTF or HTML file is in use by that first iteration and returns "file in use" errors when the section is processed again.

To write an RTF file to load into a RichText control

  1. Open WordPad, and paste the following formatted text and table into it.

    Paste into an RTF File

  2. Save the file as sample.rtf in the debug directory in the bin folder of your project.

To load the RTF file into the RichText control

  1. Double-click the detail section of the report to create an event-handling method for the Detail Format event.
  2. Add code to the handler to load the RTF file into the RichText control.
Note: The Application.Startup path code does not work in preview mode. You must run the project in order to see the file load.

The following example shows what the code for the method looks like.

To write the code in Visual Basic.NET

To write the code in C#

To write a quick HTML file to load into a RichText control

  1. Open Notepad and paste the following code into it.

    HTML code

  2. Save the file as sample.html in the debug directory in the bin folder of your project.

Loading the HTML file into a RichText control

  1. Double-click the detail section of the report to create an event-handling method for the Detail Format event.
  2. Add code to the handler to load the HTML file into the RichText control.
Note: The Application.Startup path code does not work in preview mode. You must run the project in order to see the file load.

The following example shows what the code for the method looks like.

To write the code in Visual Basic.NET

To write the code in C#

See Also

Walkthroughs

Concepts