Could not convert variant of type (String) into type (Double)

In Demo applications that shipped with Fast-Report v4 there is a sample delphi project for Printing an String Grid.
I have Pasted the source code here. if you see the source code, it produce some numbers in a StringGrid (16*16) and
then Print it with TfrxReport in OnBeforePrint with CrossView Object at runtime.
My problem here is that when you have some TEXT in some Cells instead of Numbers :

1) if you run the project in Delphi IDE,you will receive the following Error:


Debugger Exception Notification
Project Project1.exe raised exception class
EVariantTypeCastError with message
'Could not convert variant of type (String) into type (Double)'.
Process stopped. Use Step or Run to continue.
OK Help

2) if you Run the Standalone (*.ExE) file, no error will occure and nothing will appear on your Print Page!!

Here is the source code of this demo, but note that to run this app you have to have a frxReport on your form with a TfrxCrossView object in it!
procedure TForm1.FormCreate(Sender: TObject);
var
  i, j: Integer;
begin
  for i := 1 to 16 do
    for j := 1 to 16 do
      StringGrid1.Cells[i - 1, j - 1] := IntToStr(i * j);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  frxReport1.ShowReport;
end;

procedure TForm1.frxReport1BeforePrint(c: TfrxReportComponent);
var
  Cross: TfrxCrossView;
  i, j: Integer;
begin
  if c is TfrxCrossView then
  begin
    Cross := TfrxCrossView©;
    for i := 1 to 16 do
      for j := 1 to 16 do
      begin
          Cross.AddValue([i], [j], [StringGrid1.Cells[i - 1, j - 1]]);
      end;
  end;
end;



Could anyone help me?
Kind Regards.

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.