Hi,
I am having a different kind of requirement.
I have two lines of text in a single cell in Ultrawingrid.
I have to apply font size of 14 and color black to first line text.
And font size of 12 and color blue to second line text.
Could you please let me know how to do it?
Thanks,
Venkat.
above solution would resolves the issue for "<" such text coming into text xml but if you have observed in above method, in same cell - we are trying to add text as well as image and button also. whenever in cell, if image or button also gets added then again it doesn't take text as xml and display like below. See in below wherever, no button in cell then xml text displays properly but not in second row when it has button in top right corner.
Can you pls suggest some solution which could work in both scenario.
Thanks
Hi Mosam,
The problem is that the existing text has reserved characters in it, so it's failing to parse as valid Xml. Since you are now using FormattedText, the value of the cell is Xml, and so you have to be careful about using certain characters that have special meaning in Xml like "<" and ">". If I assign a value to the cell like: "<span style=\"font-size:5.25pt;\">My Tes</span>"Then that works fine. But your text contains "<Dispose Item>" before that, and that's not a valid Xml tag and even if it were, it has no closing tag. So you will need to escape those "<" and ">" signs to make them show up as literals. So this does not work: "<Dispense Item> <span style=\"font-size:5.25pt;\">Text2</span>"But this will: "<Dispense Item> <span style=\"font-size:5.25pt;\">Text2</span>"
Hi Mike,
Below is my method for customize cell format.
i have added below code to add "My Test" text in each cell's existing value which requires to be added with 5.25pt font size. and other existing text should remain with existing font size 9pt.
e.Row.Cells[i].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.FormattedText;e.Row.Cells[i].Value = e.Row.Cells[i].Value + "<font size=\"5.25pt\">\n My Test</font>";
But "My Test" is not getting added properly for each cell and display like below,
private void uGrid_InitializeRow(object sender, InitializeRowEventArgs e) { UltraGridBand m_band = e.Row.Band; try { for (int i = 1; i < m_band.Columns.Count - (CintColumnsToHide - 1); i++) { string myValue = (string)e.Row.Cells[i].Value;
e.Row.Cells[i].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.FormattedText; e.Row.Cells[i].Value = e.Row.Cells[i].Value + "<font size=\"5.25pt\">\n My Test</font>"; \\My Test should be shown with smaller font in new line
string abCode = (string)e.Row.Cells[i + 2].Value; string strHasRHistory = (string)e.Row.Cells[i + 4].Value.ToString().ToUpper(); bool isFullEditorDisplay = true;
switch abCode ()) { case "M": e.Row.Cells[i].Appearance.Image = ImageServer.GetImage("RH"); e.Row.Cells[i].Appearance.ImageHAlign = HAlign.Right; e.Row.Cells[i].Appearance.ImageVAlign = VAlign.Top; e.Row.Cells[i].CellDisplayStyle = CellDisplayStyle.FullEditorDisplay; break; case "N": e.Row.Cells[i].Appearance.Image = ImageServer.GetImage("RL"); e.Row.Cells[i].Appearance.ImageHAlign = HAlign.Right; e.Row.Cells[i].Appearance.ImageVAlign = VAlign.Top; e.Row.Cells[i].CellDisplayStyle = CellDisplayStyle.FullEditorDisplay; break; default: //e.Row.Cells[i].CellDisplayStyle = CellDisplayStyle.FormattedText; isFullEditorDisplay = false; break; }
if strHasRHistory == "TRUE" ) { UltraTextEditor uViewHistoryTextEditor = new UltraTextEditor(); if (strHasResultCorrectionHistory == "TRUE") { } EditorButton btnViewHisEditor = new EditorButton(); btnViewHisEditor.AccessibleName = "btnhasRHistory"; btnViewHisEditor.Tag = "btnhasRHistory"; btnViewHisEditor.Appearance.Image = ImageServer.GetImage("History"); btnViewHisEditor.Appearance.ImageHAlign = HAlign.Right; btnViewHisEditor.Appearance.ImageVAlign = VAlign.Top; btnViewHisEditor.ButtonStyle = UIElementButtonStyle.Borderless; btnViewHisEditor.Appearance.BackColor = Color.Transparent; uViewHistoryTextEditor.ButtonsRight.AddbtnViewHisEditor
e.Row.Cells[i].EditorComponent = uViewHistoryTextEditor; e.Row.Cells[i].CellDisplayStyle = CellDisplayStyle.FullEditorDisplay; _uResultGrid.DisplayLayout.Bands[0].Columns[i].ButtonDisplayStyle = Infragistics.Win.UltraWinGrid.ButtonDisplayStyle.Always; } else { if (isFullEditorDisplay == false) { e.Row.Cells[i].CellDisplayStyle = CellDisplayStyle.FormattedText; } }
// Column Width should be increased if Comments Text Length is more than 8 characters.. if (e.Row.Cells[i].Text.Length > 8) { m_band.Columns[i].CellMultiLine = DefaultableBoolean.True; m_band.Columns[i].Width = 200; } e.Row.PerformAutoSize(); // Auto resize row once value assigned to row... i += (CintColumnsToHide - 1); } } catch (Exception ex) { } }
Pls provide your suggestion on this
Mosam
CellDisplayStyle.FullEditorDisplay is the default. So unless you are setting CellDisplayStyle explicitly to some other value somewhere else in your code, you don't need to set it on each each. In any case, if you want two different text sizes or styles in the same cell, you can do that with FormattedText and the answer to your question is already right here in this thread...
Mike Saltzman said:You could set the Style of the column to FormattedText. And then use XML as the Value of the cell to control the formatting. The custom XML format used by a FormattedText cell in the grid is the same one used by the UltraFormattedLinkLabel or UltraFormattedTextEditor controls.
i have used e.Row.Cells[i].CellDisplayStyle = CellDisplayStyle.FullEditorDisplay into ultraGrid_InitializeRow event. Then how i can use two different font sizes for the text of the same cell?
pls let me know if any options avail.