Problem with Flexcel

Hello
I have a problem with reading an Excel cell. Then I write conditionally something into the cell. If I want to check if the writing was successfull it was not.

Here a simplified code from a huge program:

strg := XlsMontelius.GetStringFromCell(i,j);
if(strg='0') then
begin
strg := 'E';
XlsMontelius.SetCellFromString(i,j,strg);
strg1 := XlsMontelius.GetStringFromCell(i,j);
end;

strg1 is '0' instead of 'E', so it was never written!?

What is the problem?

Sincerely Peter

Hi,
I tried reproducing your code in an empty app: Just create a simple VCL app, drop a button, and write this code in the button event handler:

procedure TForm38.Button1Click(Sender: TObject);
var
  XlsMontelius: TXlsFile;
  strg: string;
  strg1: string;
const
  i = 1;
  j = 1;
begin
  XlsMontelius := TXlsFile.Create(1, TExcelFileFormat.v2019, true);
  XlsMontelius.SetCellValue(1, 1, 0);
  try
    strg := XlsMontelius.GetStringFromCell(i,j);
    if(strg='0') then
    begin
      strg := 'E';
      XlsMontelius.SetCellFromString(i,j,strg);
      strg1 := XlsMontelius.GetStringFromCell(i,j);
      ShowMessage(strg1);
    end;
  finally
    XlsMontelius.Free;
  end;
end;

end.

I get 'E' here, don't you get it?

Ps: I moved this topic from VCL Charts to FlexCel so it is simpler for me to follow it.