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

How to override RTF formatting in XRRichText

$
0
0

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).

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

Question Comments

Added By: sunay vatansever at: 12/12/2014 4:07:01 AM    

server.Document.AppendText("Yapılan değerlendirmede ");
           DocumentRange range = server.Document.AppendText( GetCurrentColumnValue("plaka").ToString());
           CharacterProperties cp = server.Document.BeginUpdateCharacters(range);
           cp.Bold = true;
           server.Document.EndUpdateCharacters(cp);
           server.Document.AppendText(" plakalı vasıtada meydana gelen arızanın giderilmesi için ");
           server.Document.AppendText(String.Format("{0}", d1));
           server.Document.AppendText(" TL+KDV ödenmesi teklif olunur.");

           xrRichText1.Rtf = server.RtfText;

Makes all the remaining text bold.

Added By: Andrew L (DevExpress Support) at: 12/12/2014 4:14:35 AM    

Hello Sunay, 

To process your recent post more efficiently, I created a separate ticket on your behalf: T186521: Problem with formatting RTF content in code. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.


Viewing all articles
Browse latest Browse all 7205

Trending Articles



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