We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

RichText Bug

Thread ID:

Created:

Updated:

Platform:

Replies:

12809 Apr 13,2004 08:06 AM Apr 14,2004 05:58 AM Windows Forms 9
loading
Tags: GridControl
Satish
Asked On April 13, 2004 08:06 AM

Hi Please find the word document for more information. Thanks Satish DataGridBoundQuestions_5296.zip

Administrator [Syncfusion]
Replied On April 13, 2004 11:29 AM

The text you place in your RichText cells must be valid RichText. Otherwise, you will get the behavior you see. Here is a sample that does not show the problem for me. forumRTF_6736.zip

Satish
Replied On April 13, 2004 08:54 PM

Hi Clay, thanks for your reply. I am using derived RichText becuase i need to add the ''Paragraph indenting'' in the toolbar. Is this cause the problem? Thanks Satish >The text you place in your RichText cells must be valid RichText. Otherwise, you will get the behavior you see. Here is a sample that does not show the problem for me. >forumRTF_6736.zip > >

Satish
Replied On April 13, 2004 11:25 PM

Hi Clay, Thanks for your reply. I am using derived RichText box becuase I need to include ''Paragraph indenting'' icons and the functionaliy in the richtext box. Do you think any problems using derived RichText box? Thanks Satish >The text you place in your RichText cells must be valid RichText. Otherwise, you will get the behavior you see. Here is a sample that does not show the problem for me. >forumRTF_6736.zip > >

Administrator [Syncfusion]
Replied On April 14, 2004 01:31 AM

In the thread for your forum post, http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=11377, there is a sample posted that has a RichText cell with a Color selection added to the edit panel. I assume you should be able to do something similar to add parargraphing in some manner.

Satish
Replied On April 14, 2004 02:41 AM

Hi Clay, Again Thanks for your reply. Myy question is why this richtext box behaves differently. Please find the application for your reference. If you make changes in the one cell (I mean font, size and color change) which will be reflecting in other cells to. Why is this? Thanks Satish >In the thread for your forum post, http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=11377, there is a sample posted that has a RichText cell with a Color selection added to the edit panel. I assume you should be able to do something similar to add parargraphing in some manner. SampleApplication_2133.zip

Satish
Replied On April 14, 2004 03:20 AM

With regards to the above problem. In order to replicate this problem, try to move the move in the rows.......... Automatically rows values will get changed.. I mean font, Size, color........ >Hi Clay, >Again Thanks for your reply. >Myy question is why this richtext box behaves differently. Please find the application for your reference. >If you make changes in the one cell (I mean font, size and color change) which will be reflecting in other cells to. Why is this? >Thanks >Satish > >>In the thread for your forum post, http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=11377, there is a sample posted that has a RichText cell with a Color selection added to the edit panel. I assume you should be able to do something similar to add parargraphing in some manner. > >SampleApplication_2133.zip > >

Administrator [Syncfusion]
Replied On April 14, 2004 03:23 AM

The reason this is happening is as I tried to explain above. The text you are putting into the datatable is not RTF. It does not include the formatting information required of RTF. In your sample, if you replace dr[j] = string.Format("row{0} col{1}", i, j); with
if(j == 1)
{
	dr[j] =  @"{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 Microsoft Sans Serif;}}"
	+@"\viewkind4\uc1\pard\f0\fs17 "
	+ string.Format("row{0} col{1}", i, j)
	+@"\par }" ;
}
else
{
	dr[j] =  string.Format("row{0} col{1}", i, j);
}
you no longer see the problem as the datatable column will contain properly formatted RTF. Another option is to modify your cell renderer to automatically convert plain text into RTF text as it tries to draw the text (this may affect performance, but it is doable). To do so, you can add a private RichTextBox, and use it to change plain text in an override of OnDraw before calling the base class. Here is code that worked for me in your sample.
private RichTextBox rtb = new RichTextBox();
protected override void OnDraw(Graphics g, Rectangle clientRectangle, int rowIndex, int colIndex, GridStyleInfo style) 
{
	if (!(CurrentCell.HasCurrentCellAt(rowIndex, colIndex) && CurrentCell.IsModified && HasControlValue))
	{
		string rtf = style.Text;
		if (!RichTextPaint.IsValidRtf(rtf))
		{
			rtb.SelectAll();
			rtb.SelectedText = rtf;
			style.Text = rtb.Rtf;
		}
	}
	base.OnDraw(g, clientRectangle, rowIndex, colIndex, style);
}

Satish
Replied On April 14, 2004 04:04 AM

Great.. Its working... If this is the case, how do i convert my existing data into RTF. Is there any way???? Thanks Satish >The reason this is happening is as I tried to explain above. The text you are putting into the datatable is not RTF. It does not include the formatting information required of RTF. In your sample, if you replace > >dr[j] = string.Format("row{0} col{1}", i, j); > >with >
>if(j == 1)
>{
>	dr[j] =  @"{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 Microsoft Sans Serif;}}"
>	+@"\viewkind4\uc1\pard\f0\fs17 "
>	+ string.Format("row{0} col{1}", i, j)
>	+@"\par }" ;
>}
>else
>{
>	dr[j] =  string.Format("row{0} col{1}", i, j);
>}
>
>you no longer see the problem as the datatable column will contain properly formatted RTF. > >Another option is to modify your cell renderer to automatically convert plain text into RTF text as it tries to draw the text (this may affect performance, but it is doable). To do so, you can add a private RichTextBox, and use it to change plain text in an override of OnDraw before calling the base class. Here is code that worked for me in your sample. >
>private RichTextBox rtb = new RichTextBox();
>protected override void OnDraw(Graphics g, Rectangle clientRectangle, int rowIndex, int colIndex, GridStyleInfo style) 
>{
>	if (!(CurrentCell.HasCurrentCellAt(rowIndex, colIndex) && CurrentCell.IsModified && HasControlValue))
>	{
>		string rtf = style.Text;
>		if (!RichTextPaint.IsValidRtf(rtf))
>		{
>			rtb.SelectAll();
>			rtb.SelectedText = rtf;
>			style.Text = rtb.Rtf;
>		}
>	}
>	base.OnDraw(g, clientRectangle, rowIndex, colIndex, style);
>}
>

Administrator [Syncfusion]
Replied On April 14, 2004 05:58 AM

You would do it the same way as the OnDraw routine listed above does it. You would get your old string, set it in the SelectedText property of a RichTextBox, and then save the RTF property of the RichTextBox back to your database. Just like the code above.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;