nexcel 读取 excel

procedure TfrmUserV3.ImportUser(const AFileName: string);
var
book :IXLSWorkBook;
ws : IXLSWorkSheet;
i,j : Integer;
v : Variant; obj : T_LoginUser;
objList : T_LoginUserInf; sCode,sName,sPwd,sGroup : string;
begin
book := TXLSWorkbook.Create; objList := T_LoginUserInf.Create;
try
i := book.Open(AFileName);
ws := book.WorkSheets[];
if ws.UsedRange.Rows.Count = then
Exit;
for i := to ws.UsedRange.Rows.Count - do
begin
if VarIsNull(ws.UsedRange.Rows[i].Item[].Value) then
Continue; sCode := ws.UsedRange.Rows[i].item[].Value;
with ws.UsedRange.Rows[i] do
begin
sName := Item[].Value;
sPwd := Item[].Value;
sGroup := Item[].Value;
end; if Trim(sCode) <> '' then
begin
obj := T_LoginUser.Create;
obj.fUserID := sCode;
obj.fUserName := sName;
obj.fPassword := sPwd;
obj.fGroupID := sGroup;
objList.fList.Add(obj);
end;
end; if objList.fList.List.Count > then
begin
objList.AddUser(MyValue.UniConn);
end;
finally
book := nil;
objList.Free;
end;
上一篇:【Android开发日记】之入门篇(五)——Android四大组件之Service


下一篇:Oracle 逐条和批量插入数据方式对比