Problem:
I am creating a data-aware report. The source data table has a column containing RTF text. I need to override several RTF settings before displaying it in XRRichText. I have tried many properties including the following but it does not work for me:
XRRichText.ForeColor
XRRichText.Font
XRRichText.TextAlignment
Solution:
The approach of modifying the RTF setting directly via the XRRichText properties will not help you achieve the desired result. The RTF format supports complex formatting for different content parts and it is impossible to manage corresponding format settings in this manner. We have already discussed this topic in detail in the following threads:
XRRichText - Font settings aren't applied correctly
XRRichText text alignment
Bold Text in XrRichText
XRRichText Default Font
rtf font override
The correct solution is to utilize special RTF-aware API. 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). This example illustrates how this component can be used to override RTF formatting and even append arbitrary content to the source RTF (see the XtraReport1.ApplyRTFModification() method).