htmlwinformsformattinginfragisticsultrawingrid

FormattedText not working in UltraWinGrid


I'm using an UltraWinGrid to present a list of actions that have been taken. This was originally a webapp, and is being converted to a winforms app, and the actions often have HTML formatting. I've set the column to use FormattedText:

band.Columns["Result"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.FormattedText;

The only HTML tags here are bold and line break, both of which, according to everything I've seen online, should be rendered by the FormattedText cells. But this is the result:enter image description here

Is there a trick to getting FormattedText to work? Some other setting for the grid that this style is dependent on? These are the settings I'm using on the grid:

UltraGridBand band = grd.DisplayLayout.Bands[0];
band.Override.CellDisplayStyle = CellDisplayStyle.FormattedText;
grd.UseOsThemes = DefaultableBoolean.False;
grd.DisplayLayout.Override.CellClickAction = CellClickAction.RowSelect;
grd.DisplayLayout.Override.RowSizing = RowSizing.AutoFree;
grd.DisplayLayout.Override.CellMultiLine = DefaultableBoolean.True;
grd.DisplayLayout.ViewStyleBand = ViewStyleBand.Horizontal;
grd.DisplayLayout.Override.SelectTypeCell = SelectType.None;
grd.DisplayLayout.Override.SelectTypeRow = SelectType.Single;
grd.DisplayLayout.Override.AllowAddNew = AllowAddNew.No;
grd.DisplayLayout.Override.AllowDelete = DefaultableBoolean.False;
grd.DisplayLayout.Override.AllowUpdate = DefaultableBoolean.False;
grd.DisplayLayout.Override.ActiveRowAppearance.Reset();
grd.DisplayLayout.Override.ActiveRowCellAppearance.Reset();

As you can see, I've even tried defaulting the whole grid to FormattedText, but without any change in results. To make things just a little more confusing, line breaks are working in the same grid, but with a different item: enter image description here

The only difference I can see is that this second example only has line breaks, while the first one combines line breaks and bold tags in the same cell.


Solution

  • I have created a grid using the same modifications you have set for the grid in your example:

    this.ultraGrid1.DisplayLayout.Bands[0].Override.CellDisplayStyle = CellDisplayStyle.FormattedText;
    this.ultraGrid1.UseOsThemes = DefaultableBoolean.False;
    this.ultraGrid1.DisplayLayout.Override.CellClickAction = CellClickAction.RowSelect;
    this.ultraGrid1.DisplayLayout.Override.RowSizing = RowSizing.AutoFree;
    this.ultraGrid1.DisplayLayout.Override.CellMultiLine = DefaultableBoolean.True;
    this.ultraGrid1.DisplayLayout.ViewStyleBand = ViewStyleBand.Horizontal;
    this.ultraGrid1.DisplayLayout.Override.SelectTypeCell = SelectType.None;
    this.ultraGrid1.DisplayLayout.Override.SelectTypeRow = SelectType.Single;
    this.ultraGrid1.DisplayLayout.Override.AllowAddNew = AllowAddNew.No;
    this.ultraGrid1.DisplayLayout.Override.AllowDelete = DefaultableBoolean.False;
    this.ultraGrid1.DisplayLayout.Override.AllowUpdate = DefaultableBoolean.False;
    this.ultraGrid1.DisplayLayout.Override.ActiveRowAppearance.Reset();
    this.ultraGrid1.DisplayLayout.Override.ActiveRowCellAppearance.Reset();
    this.ultraGrid1.DisplayLayout.Bands[0].Columns[0].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.FormattedText;
    

    This has given me the same result you are experiencing as seen below:

    enter image description here

    Which as you can see, is extracting some of the html tags inside of the text for the column, e.g: <b><i><u><font> but not applying the style correctly.

    When I comment out the following line:

    this.ultraGrid1.DisplayLayout.Bands[0].Override.CellDisplayStyle = CellDisplayStyle.FormattedText;
    

    My Grid then renders correctly as seen below:

    enter image description here