Hvis det er de her funktioner du mener:
http://www.swissdelphicenter.ch/torry/showcode.php?id=941 tror jeg du kan bruge noget i den stil(er ik testet):
// Save a TStringGrid to a file
procedure SaveStringGrid(StringGrid: TStringGrid; const FileName, FileName2: TFileName);
var
f,f2: TextFile;
i, k: Integer;
begin
AssignFile(f, FileName);
Rewrite(f);
AssignFile(f2, FileName);
Rewrite(f2);
with StringGrid do
begin
// Write number of Columns/Rows
Writeln(f, ColCount);
Writeln(f, RowCount);
// loop through cells
for i := 0 to ColCount - 1 do
for k := 0 to RowCount - 1 do
if (i = 2) and (k = 2) then
Writeln(F2, Cells[i, k])
else
Writeln(F, Cells[i, k]);
end;
CloseFile(F);
end;
// Load a TStringGrid from a file
procedure LoadStringGrid(StringGrid: TStringGrid; const FileName, FileName2: TFileName);
var
f,f2: TextFile;
iTmp, i, k: Integer;
strTemp: String;
begin
AssignFile(f, FileName);
Reset(f);
AssignFile(f2, FileName);
Reset(f2);
with StringGrid do
begin
// Get number of columns
Readln(f, iTmp);
ColCount := iTmp;
// Get number of rows
Readln(f, iTmp);
RowCount := iTmp;
// loop through cells & fill in values
for i := 0 to ColCount - 1 do
for k := 0 to RowCount - 1 do
begin
if (i = 2) and (k = 2) then
Readln(f2, strTemp);
else
Readln(f, strTemp);
Cells[i, k] := strTemp;
end;
end;
CloseFile(f);
end;
// Save StringGrid1 to 'c:\temp.txt':
procedure TForm1.Button1Click(Sender: TObject);
begin
SaveStringGrid(StringGrid1, 'c:\temp.txt');
end;
// Load StringGrid1 from 'c:\temp.txt':
procedure TForm1.Button2Click(Sender: TObject);
begin
LoadStringGrid(StringGrid1, 'c:\temp.txt');
end;