仅供参考:
excelapplication1.visible[0]:=true;
excelapplication1.workbooks.add(xlWBATWorksheet,0);
asheet:=excelapplication1.worksheets.item[1];
datamodule1.query1.First;
nc:=datamodule1.query1.RecordCount+1 ;
nf:=datamodule1.Query1.FieldCount ;
asheet.PageSetup.CenterFooter := '第 &P 页 总 &N 页';
asheet.Range[asheet.cells[1,1],asheet.cells[nc,nf]].Borders.LineStyle:=1; //
asheet.Range[asheet.cells[1,1],asheet.cells[nc,nf]].HorizontalAlignment := xlCenter;
asheet.Range[asheet.cells[1,1],asheet.cells[nc,nf]].HorizontalAlignment := xlCenter;
asheet.Range[asheet.cells[1,1],asheet.cells[nc,nf]].wraptext:=true;
asheet.Range[asheet.cells[1,1],asheet.cells[1,nf]].font.name := '黑体';