Special character in AdvStringGrid

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

Hi,

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);
    const
      user_value = '<B>Test</B>';
    begin
      if ACol = 1 then
      begin
        Value := user_value;
      end
      else if ACol = 2 then
      begin
        Value := TNetEncoding.HTML.Encode(user_value);
      end
      else if ACol = 3 then
      begin
        Value := '<>' +user_value + '</>';
      end
      else if ACol = 4 then
      begin
        Value := '<>' +TNetEncoding.HTML.Encode(user_value) + '</>';
      end;
    end;
  • 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.

Thanks,
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.