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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Rich Text in Grid Control Cell

Thread ID:

Created:

Updated:

Platform:

Replies:

71527 Feb 4,2008 08:57 PM UTC Feb 9,2008 09:28 AM UTC WinForms 3
loading
Tags: GridControl
Deepak
Asked On February 4, 2008 08:57 PM UTC

Hi,

I am trying to display some rich text in cell of a grid control, but it always displays the contents with all the formatting characters. I have set the cell type to RichText. I have also implemented the GridPrepareViewStyle, to get the cell back color and cell text color. The default text color is black, but the contents of the cell should display the rich text in a different color, for which I have the rich text format characters.

Is there something else that I need to do.

Please help.



this.mainGrid[0, iCol].Text = "Classification";
this.mainGrid.ColStyles[iCol].HorizontalAlignment = GridHorizontalAlignment.Left;
this.mainGrid.ColWidths[iCol] = 150;
this.mainGrid.ColStyles[iCol].Tag = iCol;
this.mainGrid.ColStyles[iCol].CellType = "RichText";


haneefm [Syncfusion]
Replied On February 4, 2008 11:11 PM UTC

Hi Deepak,

The RichText sample illustrates how you can display and edit RichText in the Grid Cells. It will allow you to optionally dropdown an editable RichText window where you can modify the RichText in the cell. In addition, this sample will allow you to display an event log which, will show the order of the currentcell events that are raised and the values that are present in the cell as the events occur. You will be able to see mouse events as well.

Here is a path.
C:\Documents and Settings\haneefm\My Documents\Syncfusion\EssentialStudio\5.2.0.30\Windows\Grid.Windows\Samples\2.0\CellTypes\RichTextCells\cs

Best regards,
Haneef


Deepak
Replied On February 5, 2008 11:09 PM UTC

I had a look at the sample code, I am doing something similar but I still see problems with my Rich text box.

I have pasted some sample code below




void GridPrepareViewStyle(object sender, GridPrepareViewStyleInfoEventArgs e)
{
try
{
if (e.RowIndex > 0 && e.ColIndex > 0)
{
int iCol = Convert.ToInt32(this.mainGrid.ColStyles[e.ColIndex].Tag);
if (this.displayData.Count < e.RowIndex) return;

GridData val = (GridData)this.displayData[e.RowIndex-1];

if(val!=null )
{

e.Style.TextColor = val.GetCellTextColorByIndex(iCol);
e.Style.BackColor = val.GetCellBackColorByIndex(e.RowIndex, iCol);

}
val = null;
}
}
catch (Exception er)
{
Console.WriteLine("GridPrepareViewStyle Error: " + er.Message);
}
}



This the string that has to be displayed

string sHighlightRTF = @"{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fcharset0 Arial;}}
{\colortbl ;\red255\green0\blue0;}
{\*\generator Msftedit 5.41.15.1507;}\viewkind4\uc1\pard\cf1\f0\fs20 !\cf0\par
}";





sample.zip

Jeba S [Syncfusion]
Replied On February 9, 2008 09:28 AM UTC

Hi Deepak,

Thank you for your details.

I have looked into the code provided by you.

Do you have more than one grid? The below code snippets indicates there are two grids in your application.

this.mainGrid.ColStyles[e.ColIndex].Tag
this.displayData.Count


Could you please provide some more details to reproduce the issue? Or modify the below browser sample to reproduce the issue so that we can provide you a solution early?
{Installation Drive}\Documents and Settings\{Username}\My Documents\Syncfusion\EssentialStudio\6.1.034\Windows\Grid.Windows\Samples\2.0\CellTypes\RichTextCells

Kindly let us know if you need any further assistance.

Best Regards,
Jeba.


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.

Warning Icon 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.Close Icon

;