Pergunta

I'm almost left with no time but facing a problem with DataDynamics.ActiveReports.

I have to replace some text for 500 reports so automating the task through code at run time.

The major problem I'm facing is on replacing text the original bold wont changes to normal font. center justified text will be left justified also Arial Narrow text changes to Arial.

Is there any way to replace text without disturbing the original format.

Here is the piece of code:

var textBox = (DataDynamics.ActiveReports.RichTextBox)reportSection.Controls[controlIdx];                        
                        if (textBox.Text.Contains("Babu"))
                        {
                            MessageBox.Show(textBox.Text);
                            var modifiedtext = (DataDynamics.ActiveReports.RichTextBox)reportSection.Controls[controlIdx];
                            modifiedtext.Text = modifiedtext.Text.Replace("Babu", "Mannu");
                            MessageBox.Show(modifiedtext.Text);
                        } 

The modified report has a format different than the original. How to fix this issue??

Foi útil?

Solução

its richtext, not plain text.

every rich text has a formatting associated with it.

try editing the original rtf that you are loading into the rtb control. This is what I would recommend.

Or, another approach could be to use richtextbox.rtf.replac instead of richtextbox.text.

At what time of the report processing are you doing this?

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top