105 lines
2.9 KiB
Plaintext
105 lines
2.9 KiB
Plaintext
Type TSDocxDocuments = Class(TSVbaBase)
|
|
|
|
public
|
|
Function Init();
|
|
Function Operator[](index);
|
|
Function GetActivation();
|
|
|
|
private
|
|
Function AddDocument(xlsx, name); // Completed
|
|
|
|
private
|
|
collection_;
|
|
|
|
public
|
|
// Methods
|
|
Function Add(Template, NewTemplate, DocumentType, Visible);
|
|
Function AddBlogDocument(ProviderID, PostURL, BlogName, PostID);
|
|
Function CanCheckOut(FileName);
|
|
Function CheckOut(FileName);
|
|
Function Close(SaveChanges, OriginalFormat, RouteDocument);
|
|
Function Item(Index);
|
|
Function Open(FileName, ConfirmConversions, ReadOnly, AddToRecentFiles, PasswordDocument,
|
|
PasswordTemplate, Revert, WritePasswordDocument, WritePasswordTemplate, Format,
|
|
Encoding, Visible, OpenConflictDocument, OpenAndRepair, DocumentDirection, NoEncodingDialog); // Completed
|
|
Function OpenNoRepairDialog(FileName, ConfirmConversions, ReadOnly, AddToRecentFiles,
|
|
PasswordDocument, PasswordTemplate, Revert, WritePasswordDocument,
|
|
WritePasswordTemplate, Format, Encoding, Visible, OpenAndRepair,
|
|
DocumentDirection, NoEncodingDialog, XMLTransform);
|
|
Function Save(NoPrompt, OriginalFormat); // Completed
|
|
|
|
// Properties
|
|
property Count read ReadCount;
|
|
Function ReadCount();
|
|
|
|
End;
|
|
|
|
// ============== 实现 ================= //
|
|
Function TSDocxDocuments.Init();
|
|
Begin
|
|
collection_ := new Collection();
|
|
End;
|
|
|
|
Function TSDocxDocuments.AddDocument(docx, fullname);
|
|
Begin
|
|
name := ExtractFileName(fullname);
|
|
document := new TSDocxDocument(self.Application, self.Creator, self);
|
|
document.Init(docx, collection_, name, fullname);
|
|
collection_.AddCollection(document, name);
|
|
return document;
|
|
End;
|
|
|
|
Function Operator TSDocxDocuments.[](index);
|
|
Begin
|
|
return collection_[index];
|
|
End;
|
|
|
|
Function TSDocxDocuments.GetActivation();
|
|
Begin
|
|
return collection_.GetActivation();
|
|
End;
|
|
|
|
// Methods
|
|
Function TSDocxDocuments.Add(Template, NewTemplate, DocumentType, Visible);
|
|
Begin
|
|
docx := new TSDocxFile();
|
|
docx.NewFile();
|
|
return AddDocument(docx, collection_.CalNewName("文档"));
|
|
End;
|
|
|
|
Function TSDocxDocuments.Close(SaveChanges, OriginalFormat, RouteDocument);
|
|
Begin
|
|
num := self.Count;
|
|
for i:=1 to num do
|
|
self[i].Close(SaveChanges, OriginalFormat, RouteDocument);
|
|
End;
|
|
|
|
Function TSDocxDocuments.Item(Index);
|
|
Begin
|
|
return self[Index];
|
|
End;
|
|
|
|
Function TSDocxDocuments.Open(FileName, ConfirmConversions, ReadOnly, AddToRecentFiles, PasswordDocument,
|
|
PasswordTemplate, Revert, WritePasswordDocument, WritePasswordTemplate, Format,
|
|
Encoding, Visible, OpenConflictDocument, OpenAndRepair, DocumentDirection, NoEncodingDialog);
|
|
Begin
|
|
docx := new TSDocxFile();
|
|
[err, msg] := docx.OpenFile("", FileName, PasswordDocument);
|
|
if err then return;
|
|
return AddDocument(docx, docx.FileName());
|
|
End;
|
|
|
|
Function TSDocxDocuments.Save(NoPrompt, OriginalFormat);
|
|
Begin
|
|
num := self.Count;
|
|
for i:=1 to num do
|
|
self[i].Save();
|
|
End;
|
|
|
|
// Properties
|
|
Function TSDocxDocuments.ReadCount();
|
|
Begin
|
|
return collection_.GetCount();
|
|
End;
|
|
|