Type Workbooks = class public Function Create(); Function Operator[](index); private Function AddWorkbook(xlsx, name); // Completed private collection_; public Function Add(template); // Completed Function CanCheckOut(FileName); Function CheckOut(FileName); Function Close(); Function Open(FileName, UpdateLinks, ReadOnly, Format, Password, WriteResPassword, IgnoreReadOnlyRecommended, Origin, Delimiter, Editable, Notify, Converter, AddToMru, Local, CorruptLoad); // Completed Function OpenDatabase(); Function OpenText(); Function OpenXML(); property Application read ReadApplication; property Count read ReadCount; property Creator read ReadCreator; property Item read ReadItem; property Parent read ReadParent; Function ReadCount(); // Completed Function ReadItem(index); // Completed Function ReadApplication(); Function ReadCreator(); Function ReadParent(); End; // ============== 实现 ================= // Function Workbooks.Create(); Begin collection_ := class(Collection).GetInstance('workbook'); End; Function Workbooks.AddWorkbook(xlsx, fullname); Begin name := ExtractFileName(fullname); collection_.AddCollection(new Workbook(xlsx, name, fullname), name); End; Function Operator Workbooks.[](index); Begin return collection_[index]; End; Function Workbooks.Add(template); Begin xlsx := new TSXlsxFile(); xlsx.NewFile(); AddWorkbook(xlsx, collection_.CalNewName("工作簿")); End; Function Workbooks.Open(FileName, UpdateLinks, ReadOnly, Format, Password, WriteResPassword, IgnoreReadOnlyRecommended, Origin, Delimiter, Editable, Notify, Converter, AddToMru, Local, CorruptLoad); // Completed Begin xlsx := new TSXlsxFile(); [err, msg] := xlsx.OpenFile("", FileName, Password); if err then return; AddWorkbook(xlsx, xlsx.FileName()); End; Function Workbooks.ReadCount(); Begin return collection_.GetCount(); End; Function Workbooks.ReadItem(index); Begin return self[index]; End;