95 lines
2.7 KiB
Plaintext
95 lines
2.7 KiB
Plaintext
Type TSDocxDocuments = Class(TSVbaBase)
|
|
|
|
public
|
|
Function Init();
|
|
Function Operator[](index);
|
|
Function GetActivation();
|
|
|
|
private
|
|
Function AddDocument(xlsx, name); // Completed
|
|
|
|
private
|
|
collection_;
|
|
|
|
public
|
|
Function Add(Template, NewTemplate, DocumentType, Visible); // Completed
|
|
Function AddBlogDocument(ProviderID, PostURL, BlogName, PostID);
|
|
Function CanCheckOut(FileName);
|
|
Function CheckOut(FileName);
|
|
Function Close(SaveChanges, OriginalFormat, RouteDocument);
|
|
Function Item(Index); // Completed
|
|
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
|
|
|
|
property Count read ReadCount;
|
|
Function ReadCount(); // Completed
|
|
|
|
End;
|
|
|
|
// ============== 实现 ================= //
|
|
Function TSDocxDocuments.Init();
|
|
Begin
|
|
collection_ := class(Collection).GetInstance('document');
|
|
End;
|
|
|
|
Function TSDocxDocuments.AddDocument(docx, fullname);
|
|
Begin
|
|
name := ExtractFileName(fullname);
|
|
document := new TSDocxDocument(self.Application, self.Creator, self);
|
|
document.Init(docx, name, fullname);
|
|
collection_.AddCollection(document, name);
|
|
End;
|
|
|
|
Function Operator TSDocxDocuments.[](index);
|
|
Begin
|
|
return collection_[index];
|
|
End;
|
|
|
|
Function TSDocxDocuments.GetActivation();
|
|
Begin
|
|
return collection_.GetActivation();
|
|
End;
|
|
|
|
// function
|
|
Function TSDocxDocuments.Add(Template, NewTemplate, DocumentType, Visible);
|
|
Begin
|
|
docx := new TSDocxFile();
|
|
docx.NewFile();
|
|
AddDocument(docx, collection_.CalNewName("文档"));
|
|
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;
|
|
AddDocument(docx, docx.FileName());
|
|
End;
|
|
|
|
Function TSDocxDocuments.Save(NoPrompt, OriginalFormat);
|
|
Begin
|
|
num := self.Count;
|
|
for i:=1 to num do
|
|
self[i].Save();
|
|
End;
|
|
|
|
// property
|
|
Function TSDocxDocuments.ReadCount();
|
|
Begin
|
|
return collection_.GetCount();
|
|
End;
|
|
|