вроеде как должен работать код
Код:
procedure TForm1.Button1Click(Sender: TObject);
var
XLApp,Sheet,Colum:Variant;
index,i:Integer;
begin
XLApp:= CreateOleObject('Excel.Application');
XLApp.Visible:=true;
XLApp.Workbooks.Add(-4167);
XLApp.Workbooks[1].WorkSheets[1].Name:='Отчёт';
Sheet:=XLApp.Workbooks[1].WorkSheets['Отчёт'];
for i := 1 to fDM.DSQuery1.Fields.Count do
Sheet.Cells[1,i]:= fDM.DSQuery1.Fields[i].FieldName;
fDM.DSQuery1.First;
index:=3;
//Цикл для вывода данных таблицы
for i:=0 to fDM.DSQuery1.RecordCount do begin
//Наполнение таблицы
for i := 1 to fDM.DSQuery1.Fields.Count do begin
Sheet.Cells[index,i]:= fDM.DSQuery1.Fields.Fields[i].AsString;
end;
Inc(index);
fDM.DSQuery1.Next; //Переход на следующую строку
end;
end;
появились следующие ошибки
Код:
[Error] Main.pas(319): Undeclared identifier: 'Fields'
[Error] Main.pas(325): Assignment to FOR-Loop variable 'i'
[Error] Main.pas(325): Undeclared identifier: 'RecordCount'
[Error] Main.pas(327): Assignment to FOR-Loop variable 'i'
[Error] Main.pas(327): Undeclared identifier: 'Fields'
[Error] Main.pas(328): Undeclared identifier: 'Fields'
[Error] Main.pas(328): Missing operator or semicolon
[Error] Main.pas(331): Undeclared identifier: 'Next'
[Error] Main.pas(335): '.' expected but ';' found
[Fatal Error] GK.dpr(7): Could not compile used unit 'Main.pas'