rich text box, html or xml to modify appearance
Hi--
I see the potential for the richtextbox in the report designer for making some custom look and feel tables and lists. I was wondering if the rich text box in the report designer supports html or xml and where would you enter those codes? (in the script behind?) I have loaded a rich text table from a disc file and it comes in fine, but its inert to selecting the text or making variables within the report designer. I was looking for an easier way to build tables and text paragraphs etc in the designer.
If anyone has some xml, html, or richtext languages used in the report designer, i would appreciate it.
Jeff
-
Hi Jeff,
The RichTextBox control can be modifeied in Active Reports by double clicking it. You can add datasource fields to it.
When you load data into the control it embeds the dta inside the report. You can load rtf or html file. If you update the external file the report will not recognise changes.
If you want to re load the external file when the report runs you will need to add some code. (search google for 'ActiveReports 6 User Guide' it has code examples)
Here is an example of a basic rtf file:
This is a sample Rich text document that contains the
Current Date: [!date].
It also contains a refernce to the reports datasource field
ObjectID: [!OBJECTID]Here is the code to load the file. assumes the .rtf file is in the same place as the .rpt (not sure if it will display correctly in this forum)
I have just added it to the report start event handler.
<pre>
<code>public void ActiveReport_ReportStart()
{
//get a reference to the RichTextBox control
RichTextBox richTextBox = rpt.Sections["Detail1"].Controls["RichTextBox3" ] as RichTextBox ;
//Load the contents of an external .rtf file into the RichTextBox control
System.IO.FileStream streamRTF = new System.IO.FileStream("sample.rtf", System.IO.FileMode.Open);
richTextBox.Load(streamRTF, RichTextType.Rtf);
//you could also load html file
//richTextBox.Load(streamHTML, RichTextType.Html);
//Update the contents of a user defined 'field' called date ie [!date]
richTextBox.ReplaceField("date", System.DateTime.Today.Date.ToShortDateString());
}</code>
</pre>0 -
i will try this today, but this functionality would allow us to build reports with forms very quickly.
Thank you
Jeff
0
Please sign in to leave a comment.
Comments
2 comments