
如上圖所示,經過測驗發現為什么程式在批量測驗程序中for陳述句不執行???
procedure TForm1.OutputTxtFile(AFileName: string; AGraphRec: TGraphRec; Number1: integer); //呼叫到 StringGrid顯示的方法
var
h,s,j:integer;
ExcelApp: OleVariant;
count,num,i:integer;
number2:string;
begin
try
ExcelApp := CreateOLEObject('Excel.Application');
except
Application.MessageBox('Excel沒有安裝!', '提示資訊', MB_OK+MB_ICONASTERISK+MB_DEFBUTTON1+MB_APPLMODAL);
Exit;
end;
with AGraphRec do
begin
try
StringGrid1.Cells[0,Number1]:=TrayID;
for i:=0 to length(AGraphRec.GraphData)-1 do //批量回圈無呼叫??
begin
if (Format('%.1f',[AGraphRec.GraphData[i].Current[0]])>'3900')
then
StringGrid1.Cells[Number1,Number1]:=format('%.1f',[AGraphRec.GraphData[i].Temperature[0]/20]);
StringGrid1.Cells[Number1,Number1]:=inttostr(i);
end;
procedure TForm1.Button2Click(Sender: TObject); //按鈕方法
var
gd:TGraphData;
i:integer;
Path:string;
BValue:TGraphRec;
begin
for i:=0 to self.Memo1.Lines.Count-1 do
begin
GetGraphRec(Memo1.Lines[i],BValue);
OutputTxtFile(strutils.AnsiReplaceStr(lowercase(Memo1.Lines[i]),'.dat','.xls'),BValue,i+1);
// Memo2.Lines.Add(strutils.AnsiReplaceStr(lowercase(Memo1.Lines[i]),'.dat','.xls'));
end;
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/41277.html
標籤:VCL組件開發及應用
