Problem:
I am creating a data-aware report. The source data table has several columns containing RTF text. I need to concatenate the contents of these columns and display it in a single XRRichText.
Solution:
As you probably know, RTF strings cannot be concatenated directly (strResult = strSource1 + strSource2) because it will result in invalid RTF content. Instead, utilize special RTF-aware API to accomplish this task. Our XtraRichEdit Suite provides you with this API. In v2011 vol 1 we have implemented the non-visual RichEditDocumentServer component (in previous versions use the RichEditControl Class instead). You can use its RtfText property and Document.AppendRtfText() method (see the SubDocument.AppendRtfText Method). Thus, handle the XRRichText.BeforePrint event, obtain current RTF field values via the XtraReportBase.GetCurrentColumnValue Method, concatenate them by using the aforementioned API and assign the resulting RTF to the XRRichText.Rtf Property.