Special character in AdvStringGrid

Windows 7 SP1 x64
RAD Studio 10.1 Berlin Update 2
TMS VCL UI Pack v10.1.6.2


I would like to know if the following results are normal:
  • Create a new form and add an AdvStringGrid.
  • Set the OnGetDisplText to:
    procedure TForm1.AdvStringGrid1GetDisplText(Sender: TObject; ACol, ARow: Integer; var Value: string);
      user_value = '<B>Test</B>';
      if ACol = 1 then
        Value := user_value;
      else if ACol = 2 then
        Value := TNetEncoding.HTML.Encode(user_value);
      else if ACol = 3 then
        Value := '<>' +user_value + '</>';
      else if ACol = 4 then
        Value := '<>' +TNetEncoding.HTML.Encode(user_value) + '</>';
  • Run the program.

The first column displays: "Test"
The second column displays "&lt;B&gt;Test&lt;/B&gt;"
The third column displays: "Test"
The forth column displays: "<B>Test</B>"

Is it normal for the second column to not render the HTML character escapement?
I can always use the grid with empty tag like I do in forth column, since I do not want the user_value to be rendered, but it does seems a bit strange.

Raphaël Sylvain

Yes it is normal.
For processing speed the detection if a cell contains HTML formatted text is simple, i.e. it checks for the presence of an end tag </  
For column 2, the actual cell data doesn't contain such tag. You can add a dummy tag to force the grid to interpret the cell text as HTML formatted text.