book := TXLSWorkbook.Create; try if book.Open(AFIleName) = -1 then begin raise Exception.Create('请检查导入的文件是否存在或Excel已经处于打开状态(如果已经打开,请尝试关闭文件再导入)'); end; ws := book.WorkSheets[1]; if ws.UsedRange.Rows.Count = 0 then begin Exit; end;
book := TXLSWorkbook.Create; try if book.Open(AFIleName) = -1 then begin raise Exception.Create('请检查导入的文件是否存在或Excel已经处于打开状态(如果已经打开,请尝试关闭文件再导入)'); end; ws := book.WorkSheets[1]; if ws.UsedRange.Rows.Count = 0 then begin Exit; end;
转载于:https://www.cnblogs.com/starluck/p/8468635.html