举个例子:
var
VExcel: Variant;
begin
VExcel:= CreateOleObject('Excel.Application');
VExcel.Visible := True;
VExcel.Workbooks.Open(FilePath);
aSheet:= VExcel.ActiveWorkBook.WorkSheets[1]; //取得WorkBook中的一页WorkSheet
aSheet.Rows[2].RowHeight := 20; //设置行高
aSheet.Rows[2].VerticalAlignment := 2;//xlCenter(垂直对齐方式)//居中
aSheet.Rows[2].HorizontalAlignment := 3;//xlCenter(水平对齐方式)//居中
... ...
if not VarIsEmpty(VExcel) then
begin
VExcel.Quit;
VExcel:= Unassigned;
end;
end;