Quantcast
Channel: DevExpress Support Center (Examples)
Viewing all articles
Browse latest Browse all 7205

How to concatenate values of several RTF fields to display the resulting RTF content in a single XRRichText control

$
0
0

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.


Viewing all articles
Browse latest Browse all 7205

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>