Edit created cells

Use this approach if you need to change cells that have been already created:
procedure TForm1.BtnTestClick(Sender: TObject);
var
  xExport: TOExport;
  xCell: TExportCell;
begin
  xExport := TOExport.Create;
  try
    with xExport.AddWorkSheet('transform') do begin

      //Create some string cells
      with AddRow do begin
        AddCellString('one').SetBGColor(clRed).SetFontColor(clWhite);
        AddCellString('two').SetBGColor(clGreen).SetFontColor(clWhite);
        AddCellString('three').SetBGColor(clBlue).SetFontColor(clWhite);
      end;

      //recreate A1 (one) cell as number
      TExportCellNumber(FindCreateCell(0, 0, TExportCellNumber)).SetValue(101.54);

      //create D1 (not created) cell as date
      TExportCellDate(FindCreateCell(3, 0, TExportCellDate)).SetValue(Now());

      //transform B1 (two) to time
      FindCell(1, 0, xCell);
      TExportCellTime(xCell.Transform(TExportCellTime)).SetValue(Now());

    end;

    xExport.SaveToFile('test.xls', True);
  finally
    xExport.Free;
  end;
end;
Categories