Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
var
ArrayOfData : variant;
excelapp, excelsht: variant;
begin
//create an array
ArrayOfData := VarArrayCreate([0, 100, 0, 2], varOleStr);
//fill the array
for i := 1 to 99 do
begin
ArrayOfData [i, 0] := qry.FieldByName('Field1').AsString;
ArrayOfData [i, 1] := qry.FieldBYName('Field2').AsString;
qry.Next;
end;
//initialize Excel
excelapp:= CreateOleObject('Excel.Application');
excelapp.Visible := False;
excelapp.Workbooks.Add;
excelsht := excelapp.WorkSheets.Item['Sheet1'];
excelsht.Activate;
//transfer entire array to spreadsheet
excelsht.Range[excelsht.Cells.Item[1, 1], excelsht.Cells.Item[(100), 2]].Value := ArrayOfData;
//save and close
excelapp.displayalerts := False;
excelsht.SaveAs('R:\Labels.xls');
excelapp.Workbooks.Close;
excelapp.quit;
end;