Zum Hauptinhalt gehen

rich text box, html or xml to modify appearance

Kommentare

2 Kommentare

  • Permanently deleted user

    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
  • Permanently deleted user

    i will try this today, but this functionality would allow us to build reports with forms very quickly.  

    Thank you

    Jeff

     

    0

Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.