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. |
Paste into an RTF File
Customer List by Country
Argentina
Austria
Belgium
Brazil
Month | Sales |
---|---|
October | $4,872 |
November | $8,517 |
December | $9,623 |
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
Visual Basic.NET code. Paste INSIDE the Detail Format event. |
Copy Code |
---|---|
Dim streamRTF As New System.IO.FileStream(System.Windows.Forms.Application.StartupPath + "\sample.rtf", System.IO.FileMode.Open) Me.RichTextBox1.Load(streamRTF, RichTextType.Rtf) |
To write the code in C#
C# code. Paste INSIDE the Detail Format event. |
Copy Code |
---|---|
System.IO.FileStream streamRTF = new System.IO.FileStream(System.Windows.Forms.Application.StartupPath + "\\sample.rtf", System.IO.FileMode.Open); this.RichTextBox1.Load(streamRTF, RichTextType.Rtf); |
HTML code
HTML code. Paste in a NotePad file. |
Copy Code |
---|---|
<html> <body> <center><h1>Customer List by Country</h1></center> <h1>Argentina</h1> <ul> <li>Rancho grande <li>Océano Atlántico Ltda. <li>Cactus Comidas para llevar </ul> <h1>Austria</h1> <ul> <li>Piccolo und mehr <li>Ernst Handel </ul> <h1>Belgium</h1> <ul> <li>Suprêmes délices <li>Maison Dewey </ul> <h1>Brazil</h1> <ul> <li>Familia Arquibaldo <li>Wellington Improtadora <li>Que Delícia <li>Tradição Hipermercados <li>Ricardo Adocicados <li>Hanari Carnes <li>Queen Cozinha <li>Comércio Mineiro <li>Gourmet Lanchonetes </ul> <table> <tr><th>Month</th><th>Sales</th></tr> <tr><td>October</td><td>$4,872</td></tr> <tr><td>November</td><td>$8,517</td></tr> <tr><td>December</td><td>$9,623</td></tr> </table> </body> </html> |
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
Visual Basic.NET code. Paste INSIDE the Detail Format event. |
Copy Code |
---|---|
Dim streamHTML As New System.IO.FileStream(System.Windows.Forms.Application.StartupPath + "\sample.HTML", System.IO.FileMode.Open) Me.RichTextBox1.Load(streamHTML, RichTextType.Html) |
To write the code in C#
C# code. Paste INSIDE the Detail Format event. |
Copy Code |
---|---|
System.IO.FileStream streamHTML = new System.IO.FileStream(System.Windows.Forms.Application.StartupPath + "\\sample.html", System.IO.FileMode.Open); this.RextTextBox1.Load(streamHTML, RichTextType.Html); |