export delphi stringgrid to excel

The quickest way is to use an array of Variant,and just pass the entire array to Excel: uses OleAuto; var xls, wb, Range: OLEVariant; arrData: Variant; RowCount, ColCount, i, j: Integer; begin {create variant array where we’ll copy our data} RowCount := StringGrid1.RowCount; ColCount := StringGrid1.ColCount; arrData := VarArrayCreate([1, RowCount, 1, ColCount], varVariant); {fill array} … Read more