No TXLSReadWriteII defined - while exporting query to Excel
Posted: Fri Oct 14, 2016 11:51 am
I am trying to export AmountQry to Excel, my code is:
Unfortunately, XLSDbRead.Read gives error message 'XLSReadWriteII defined'. How can I remove this error message and proceed with export?
Code: Select all
procedure TestExport;
var XLS: TXLSReadWriteII5;
XLSDbRead: TXLSDbRead5;
v: TExcelVersion;
begin
XLS:=TXLSReadWriteII5.Create(Self);
with XLS do begin
Version := xvExcel2007;
XLS.Filename:='D:\TMP_EXCEL\Mn.xlsx';
DirectRead := False;
DirectWrite := False;
XLS.Add;
//XLS.Sheets[0].AsString[0, 0] := 'test 1';
//XLS.Sheets[0].AsString[0, 1] := 'test 2';
//XLS.Sheets[0].AsString[1, 0] := 'test 3';
//XLS.Write;
end;
XLSDbRead:=TXLSDbRead5.Create(Self);
with XLSDbRead do begin
Dataset := AmountQry;
IncludeFieldnames := True;
IndentDetailTables := True;
ReadDetailTables := True;
FormatCells := False;
Row := 0;
Sheet := 0;
XLS := XLS;
end;
XLSDbRead.Read;
XLS.Write;
end;