remov xlsx
This commit is contained in:
parent
b9e419541b
commit
5a002f9767
|
|
@ -1,437 +0,0 @@
|
||||||
Type Workbook = class
|
|
||||||
|
|
||||||
public
|
|
||||||
Function Create(object, name, fullname);
|
|
||||||
Function Init(object);
|
|
||||||
|
|
||||||
private
|
|
||||||
xlsx_;
|
|
||||||
file_name_;
|
|
||||||
full_name_;
|
|
||||||
collection_;
|
|
||||||
|
|
||||||
public
|
|
||||||
Function AcceptAllChanges();
|
|
||||||
Function Activate();
|
|
||||||
Function AddToFavorite();
|
|
||||||
Function ApplyTheme();
|
|
||||||
Function BreakLink(Name, Type);
|
|
||||||
Function CanCheckIn();
|
|
||||||
Function ChangeFileAccess(Mode, WritePassword, Notify);
|
|
||||||
Function ChangeLink(Name, NewName, Type);
|
|
||||||
Function CheckIn(SaveChanges, Comments, MakePublic);
|
|
||||||
Function CheckInWithVersion(SaveChanges, Comments, MakePublic, VersionType);
|
|
||||||
Function Close(SaveChanges, FileName, RouteWorkbook); // Completed
|
|
||||||
Function ConvertComments();
|
|
||||||
Function CreateForecastSheet(Timeline, Values_, ForecastStart, ForecasetEnd, ConfInt, Seasonality, DataCompletion, Aggregation, ChartType, ShowStatsTable);
|
|
||||||
Function DeleteNumberFormat(NumberFormat);
|
|
||||||
Function EnableConnections();
|
|
||||||
Function EndReview();
|
|
||||||
Function ExclusiveAccess();
|
|
||||||
Function ExportAsFixedFormat (Type, FileName, Quality, IncludeDocProperties, IgnorePrintAreas, From_, To_, OpenAfterPublish, FixedFormatExtClassPtr);
|
|
||||||
Function FollowHyperlink (Address, SubAddress, NewWindow, AddHistory, ExtraInfo, Method, HeaderInfo);
|
|
||||||
Function ForwardMailer();
|
|
||||||
Function GetWorkflowTasks();
|
|
||||||
Function GetWorkflowTemplates();
|
|
||||||
Function HighlightChangesOptions(When, Who, Where_);
|
|
||||||
Function LinkInfo (Name, LinkInfo, Type, EditionRef);
|
|
||||||
Function LinkSources (Type);
|
|
||||||
Function LockServerFile();
|
|
||||||
Function MergeWorkbook (FileName);
|
|
||||||
Function NewWindow();
|
|
||||||
Function OpenLinks(Name, ReadOnly, Type);
|
|
||||||
Function PivotCaches();
|
|
||||||
Function Post();
|
|
||||||
Function PrintOut(From_, To_, Copies, Preview, ActivePrinter, PrintToFile, Collate, PrToFileName, IgnorePrintAreas);
|
|
||||||
Function PrintPreview(EnableChanges);
|
|
||||||
Function Protect(Password, Structure, Windows);
|
|
||||||
Function ProtectSharing(FileName, Password, WriteResPassword, ReadOnlyRecommended, CreateBackup, SharingPassword, FileFormat);
|
|
||||||
Function PublishToDocs();
|
|
||||||
Function PurgeChangeHistoryNow(Days, SharingPassword);
|
|
||||||
Function RefreshAll();
|
|
||||||
Function RejectAllChanges(When, Who, Where_);
|
|
||||||
Function ReloadAs(Encoding);
|
|
||||||
Function RemoveDocumentInformation(RemoveDocInfoType);
|
|
||||||
Function RemoveUser(Index);
|
|
||||||
Function Reply();
|
|
||||||
Function ReplyAll();
|
|
||||||
Function ReplyWithChanges(ShowMessage);
|
|
||||||
Function ResetColors();
|
|
||||||
Function RunAutoMacros(Which);
|
|
||||||
Function Save(); // Completed
|
|
||||||
Function SaveAs(FileName, FileFormat, Password, WriteResPassword, ReadOnlyRecommended, CreateBackup, AccessMode,
|
|
||||||
ConflictResolution, AddToMru, TextCodepage, TextVisualLayout, Local); // Completed
|
|
||||||
Function SaveAsXMLData(FileName, Map);
|
|
||||||
Function SaveCopyAs(FileName); // Completed
|
|
||||||
Function SendFaxOverInternet(Recipients, Subject, ShowMessage);
|
|
||||||
Function SendForReview(Recipients, Subject, ShowMessage, IncludeAttachment);
|
|
||||||
Function SendMail(Recipients, Subject, ReturnReceipt);
|
|
||||||
Function SendMailer(FileFormat, Priority);
|
|
||||||
Function SetLinkOnData(Name, Procedure_);
|
|
||||||
Function SetPasswordEncryptionOptions(PasswordEncryptionProvider, PasswordEncryptionAlgorithm, PasswordEncryptionKeyLength, PasswordEncryptionFileProperties);
|
|
||||||
Function ToggleFormsDesign();
|
|
||||||
Function Unprotect(Password);
|
|
||||||
Function UnprotectSharing(SharingPassword);
|
|
||||||
Function UpdateFromFile();
|
|
||||||
Function UpdateLink(Name, Type);
|
|
||||||
Function WebPagePreview();
|
|
||||||
Function XmlImport(Url, ImportMap, Overwrite, Destination);
|
|
||||||
Function XmlImportXml(Data, ImportMap, Overwrite, Destination);
|
|
||||||
|
|
||||||
property AccuracyVersion read ReadAccuracyVersion write WriteAccuracyVersion;
|
|
||||||
property ActiveChart read ReadActiveChart;
|
|
||||||
property ActiveSheet read ReadActiveSheet; // Completed
|
|
||||||
property ActiveSlicer read ReadActiveSlicer;
|
|
||||||
property Application read ReadApplication;
|
|
||||||
property AutoSaveOn read ReadAutoSaveOn write WriteAutoSaveOn;
|
|
||||||
property AutoUpdateFrequency read ReadAutoUpdateSaveChanges write WriteAutoUpdateSaveChanges;
|
|
||||||
property AutoUpdateSaveChanges read ReadAutoUpdateSaveChanges write WriteAutoUpdateSaveChanges;
|
|
||||||
property BuiltinDocumentProperties read ReadBuiltinDocumentProperties; // TODO
|
|
||||||
property CalculationVersion read ReadCalculationVersion; // TODO
|
|
||||||
property CaseSensitive read ReadCaseSensitive; // TODO
|
|
||||||
property ChangeHistoryDuration read ReadChangeHistoryDuration write WirteChangeHistoryDuration;
|
|
||||||
property ChartDataPointTrack read ReadChartDataPointTrack write WriteChartDataPointTrack;
|
|
||||||
property Charts read ReadCharts; // TODO
|
|
||||||
property CheckCompatibility read ReadCheckCompatibility write WriteCheckCompatibility;
|
|
||||||
property CodeName read ReadCodeName;
|
|
||||||
property Colors read ReadColors write WriteColors;
|
|
||||||
property CommandBars read ReadCommandBars;
|
|
||||||
property ConflictResolution read ReadConflictResolution write WriteConflictResolution;
|
|
||||||
property Connections read ReadConnections;
|
|
||||||
property ConnectionsDisabled read ReadConnectionsDisabled;
|
|
||||||
property Container read ReadContainer;
|
|
||||||
property ContentTypeProperties read ReadContentTypeProperties;
|
|
||||||
property CreateBackup read ReadCreateBackup;
|
|
||||||
property Creator read ReadCreator;
|
|
||||||
property CustomDocumentProperties read ReadCustomDocumentProperties write WriteCustomDocumentProperties; // TODO
|
|
||||||
property CustomViews read ReadCustomViews;
|
|
||||||
property CustomXMLParts read ReadCustomXMLParts;
|
|
||||||
property Date1904 read ReadDate1904 write WriteDate1904;
|
|
||||||
property DefaultPivotTableStyle read ReadDefaultPivotTableStyle write WriteDefaultPivotTableStyle;
|
|
||||||
property DefaultSlicerStyle read ReadDefaultSlicerStyle write WriteDefaultSlicerStyle;
|
|
||||||
property DefaultTableStyle read ReadDefaultTableStyle write WriteDefaultTableStyle; // TODO
|
|
||||||
property DefaultTimelineStyle read ReadDefaultTimelineStyle write WriteDefaultTimelineStyle;
|
|
||||||
property DisplayDrawingObjects read ReadDisplayDrawingObjects write WriteDisplayDrawingObjects;
|
|
||||||
property DisplayInkComments read ReadDisplayInkComments write WriteDisplayInkComments;
|
|
||||||
property DocumentInspectors read ReadDocumentInspectors;
|
|
||||||
property DocumentLibraryVersions read ReadDocumentLibraryVersions;
|
|
||||||
property DoNotPromptForConvert read ReadDoNotPromptForConvert write WriteDoNotPromptForConvert;
|
|
||||||
property EnableAutoRecover read ReadEnableAutoRecover write WriteEnableAutoRecover;
|
|
||||||
property EncryptionProvider read ReadEncryptionProvider write WriteEncryptionProvider;
|
|
||||||
property EnvelopeVisible read ReadEnvelopeVisible write WriteEnvelopeVisible;
|
|
||||||
property Excel4IntlMacroSheets read ReadExcel4IntlMacroSheets;
|
|
||||||
property Excel4MacroSheets read ReadExcel4MacroSheets;
|
|
||||||
property Excel8CompatibilityMode read ReadExcel8CompatibilityMode;
|
|
||||||
property FileFormat read ReadFileFormat;
|
|
||||||
property Final read ReadFinal write WriteFinal;
|
|
||||||
property ForceFullCalculation read ReadForceFullCalculation write WriteForceFullCalculation;
|
|
||||||
property FullName read ReadFullName; // Completed
|
|
||||||
property FullNameURLEncoded read ReadFullNameURLEncoded;
|
|
||||||
property HasPassword read ReadHasPassword;
|
|
||||||
property HasVBProject read ReadHasVBProject;
|
|
||||||
property HighlightChangesOnScreen read ReadHighlightChangesOnScreen write WriteHighlightChangesOnScreen;
|
|
||||||
property IconSets read ReadIconSets;
|
|
||||||
property InactiveListBorderVisible read ReadInactiveListBorderVisible write WriteInactiveListBorderVisible;
|
|
||||||
property IsAddin read ReadIsAddin write WriteIsAddin;
|
|
||||||
property IsInplace read ReadIsInplace;
|
|
||||||
property KeepChangeHistory read ReadKeepChangeHistory write WriteKeepChangeHistory;
|
|
||||||
property ListChangesOnNewSheet read ReadListChangesOnNewSheet write WriteListChangesOnNewSheet;
|
|
||||||
property Mailer read ReadMailer write WriteMailer;
|
|
||||||
property Model read ReadModel;
|
|
||||||
property MultiUserEditing read ReadMultiUserEditing;
|
|
||||||
property Name read ReadName;
|
|
||||||
property Names read ReadNames;
|
|
||||||
property Parent read ReadParent;
|
|
||||||
property Password read ReadPassword write WritePassword; // Completed
|
|
||||||
property PasswordEncryptionAlgorithm read ReadPasswordEncryptionAlgorithm;
|
|
||||||
property PasswordEncryptionFileProperties read ReadPasswordEncryptionFileProperties;
|
|
||||||
property PasswordEncryptionKeyLength read ReadPasswordEncryptionKeyLength;
|
|
||||||
property PasswordEncryptionProvider read ReadPasswordEncryptionProvider;
|
|
||||||
property Path read ReadPath;
|
|
||||||
property Permission read ReadPermission;
|
|
||||||
property PersonalViewListSettings read ReadPersonalViewListSettings write WritePersonalViewListSettings;
|
|
||||||
property PersonalViewPrintSettings read ReadPersonalViewPrintSettings write WritePersonalViewPrintSettings;
|
|
||||||
property PivotTables read ReadPivotTables;
|
|
||||||
property PrecisionAsDisplayed read ReadPrecisionAsDisplayed write WritePrecisionAsDisplayed;
|
|
||||||
property ProtectStructure read ReadProtectStructure;
|
|
||||||
property ProtectWindows read ReadProtectWindows;
|
|
||||||
property PublishObjects read ReadPublishObjects;
|
|
||||||
property Queries read ReadQueries;
|
|
||||||
property ReadOnly read ReadReadOnly;
|
|
||||||
property ReadOnlyRecommended read ReadReadOnlyRecommended;
|
|
||||||
property RemovePersonalInformation read ReadRemovePersonalInformation write WriteRemovePersonalInformation;
|
|
||||||
property Research read ReadResearch;
|
|
||||||
property RevisionNumber read ReadRevisionNumber;
|
|
||||||
property Saved read ReadSaved write WriteSaved;
|
|
||||||
property SaveLinkValues read ReadSaveLinkValues write WriteSaveLinkValues;
|
|
||||||
property SensitivityLabel read ReadSensitivityLabel;
|
|
||||||
property ServerPolicy read ReadServerPolicy;
|
|
||||||
property ServerViewableItems read ReadServerViewableItems;
|
|
||||||
property Sheets read ReadSheets; // TODO - 差chartsheet
|
|
||||||
property ShowConflictHistory read ReadShowConflictHistory write WriteShowConflictHistory;
|
|
||||||
property ShowPivotChartActiveFields read ReadShowPivotChartActiveFields write WriteShowPivotChartActiveFields;
|
|
||||||
property ShowPivotTableFieldList read ReadShowPivotTableFieldList write WriteShowPivotTableFieldList;
|
|
||||||
property Signatures read ReadSignatures;
|
|
||||||
property SlicerCaches read ReadSlicerCaches;
|
|
||||||
property SmartDocument read ReadSmartDocument;
|
|
||||||
property Styles read ReadStyles; // TODO
|
|
||||||
property TableStyles read ReadTableStyles;
|
|
||||||
property TemplateRemoveExtData read ReadTemplateRemoveExtData write WriteTemplateRemoveExtData;
|
|
||||||
property Theme read ReadTheme;
|
|
||||||
property UpdateLinks read ReadUpdateLinks write WriteUpdateLinks;
|
|
||||||
property UpdateRemoteReferences read ReadUpdateRemoteReferences write WriteUpdateRemoteReferences;
|
|
||||||
property UserStatus read ReadUserStatus;
|
|
||||||
property UseWildcardsoperty read ReadUseWildcardsoperty;
|
|
||||||
property VBASigned read ReadVBASigned;
|
|
||||||
property VBProject read ReadVBProject;
|
|
||||||
property WebOptions read ReadWebOptions;
|
|
||||||
property Windows read ReadWindows;
|
|
||||||
property Worksheets read ReadWorkSheets; // Completed
|
|
||||||
property WritePassword read ReadWritePassword write WriteWritePassword;
|
|
||||||
property WriteReserved read ReadWriteReserved;
|
|
||||||
property WriteReservedBy read ReadWriteReservedBy;
|
|
||||||
property XmlMaps read ReadXmlMaps;
|
|
||||||
property XmlNamespaces read ReadXmlNamespaces;
|
|
||||||
Function ReadXmlNamespaces();
|
|
||||||
Function ReadXmlMaps();
|
|
||||||
Function ReadWriteReservedBy();
|
|
||||||
Function ReadWriteReserved();
|
|
||||||
Function WriteWritePassword();
|
|
||||||
Function ReadWritePassword();
|
|
||||||
Function ReadWorkSheets(index);
|
|
||||||
Function ReadWindows();
|
|
||||||
Function ReadWebOptions();
|
|
||||||
Function ReadVBProject();
|
|
||||||
Function ReadVBASigned();
|
|
||||||
Function ReadUseWildcardsoperty();
|
|
||||||
Function ReadUseWholeCellCriteria();
|
|
||||||
Function ReadUserStatus();
|
|
||||||
Function WriteUpdateRemoteReferences();
|
|
||||||
Function ReadUpdateRemoteReferences();
|
|
||||||
Function WriteUpdateLinks();
|
|
||||||
Function ReadUpdateLinks();
|
|
||||||
Function ReadTheme();
|
|
||||||
Function WriteTemplateRemoveExtData();
|
|
||||||
Function ReadTemplateRemoveExtData();
|
|
||||||
Function ReadTableStyles();
|
|
||||||
Function ReadStyles();
|
|
||||||
Function ReadSmartDocument();
|
|
||||||
Function ReadSlicerCaches();
|
|
||||||
Function ReadSignatures();
|
|
||||||
Function WriteShowPivotTableFieldList();
|
|
||||||
Function ReadShowPivotTableFieldList();
|
|
||||||
Function WriteShowPivotChartActiveFields();
|
|
||||||
Function ReadShowPivotChartActiveFields();
|
|
||||||
Function WriteShowConflictHistory();
|
|
||||||
Function ReadShowConflictHistory();
|
|
||||||
Function ReadSheets();
|
|
||||||
Function ReadServerViewableItems();
|
|
||||||
Function ReadServerPolicy();
|
|
||||||
Function ReadSensitivityLabel();
|
|
||||||
Function WriteSaveLinkValues();
|
|
||||||
Function ReadSaveLinkValues();
|
|
||||||
Function WriteSaved();
|
|
||||||
Function ReadSaved();
|
|
||||||
Function ReadRevisionNumber();
|
|
||||||
Function ReadResearch();
|
|
||||||
Function WriteRemovePersonalInformation();
|
|
||||||
Function ReadRemovePersonalInformation();
|
|
||||||
Function ReadReadOnlyRecommended();
|
|
||||||
Function ReadReadOnly();
|
|
||||||
Function ReadQueries();
|
|
||||||
Function ReadPublishObjects();
|
|
||||||
Function ReadProtectWindows();
|
|
||||||
Function ReadProtectStructure();
|
|
||||||
Function WritePrecisionAsDisplayed();
|
|
||||||
Function ReadPrecisionAsDisplayed();
|
|
||||||
Function ReadPivotTables();
|
|
||||||
Function WritePersonalViewPrintSettings();
|
|
||||||
Function ReadPersonalViewPrintSettings();
|
|
||||||
Function WritePersonalViewListSettings();
|
|
||||||
Function ReadPersonalViewListSettings();
|
|
||||||
Function ReadPermission();
|
|
||||||
Function ReadPath();
|
|
||||||
Function ReadPasswordEncryptionProvider();
|
|
||||||
Function ReadPasswordEncryptionKeyLength();
|
|
||||||
Function ReadPasswordEncryptionFileProperties();
|
|
||||||
Function ReadPasswordEncryptionAlgorithm();
|
|
||||||
Function WritePassword(passwd);
|
|
||||||
Function ReadPassword();
|
|
||||||
Function ReadParent();
|
|
||||||
Function ReadNames();
|
|
||||||
Function ReadName();
|
|
||||||
Function ReadMultiUserEditing();
|
|
||||||
Function ReadModel();
|
|
||||||
Function WriteMailer();
|
|
||||||
Function ReadMailer();
|
|
||||||
Function WriteListChangesOnNewSheet();
|
|
||||||
Function ReadListChangesOnNewSheet();
|
|
||||||
Function WriteKeepChangeHistory();
|
|
||||||
Function ReadKeepChangeHistory();
|
|
||||||
Function ReadIsInplace();
|
|
||||||
Function WriteIsAddin();
|
|
||||||
Function ReadIsAddin();
|
|
||||||
Function WriteInactiveListBorderVisible();
|
|
||||||
Function ReadInactiveListBorderVisible();
|
|
||||||
Function ReadIconSets();
|
|
||||||
Function WriteHighlightChangesOnScreen();
|
|
||||||
Function ReadHighlightChangesOnScreen();
|
|
||||||
Function ReadHasVBProject();
|
|
||||||
Function ReadHasPassword();
|
|
||||||
Function ReadFullNameURLEncoded();
|
|
||||||
Function ReadFullName();
|
|
||||||
Function WriteForceFullCalculation();
|
|
||||||
Function ReadForceFullCalculation();
|
|
||||||
Function WriteFinal();
|
|
||||||
Function ReadFinal();
|
|
||||||
Function ReadFileFormat();
|
|
||||||
Function ReadExcel8CompatibilityMode();
|
|
||||||
Function ReadExcel4MacroSheets();
|
|
||||||
Function ReadExcel4IntlMacroSheets();
|
|
||||||
Function WriteEnvelopeVisible();
|
|
||||||
Function ReadEnvelopeVisible();
|
|
||||||
Function WriteEncryptionProvider();
|
|
||||||
Function ReadEncryptionProvider();
|
|
||||||
Function WriteEnableAutoRecover();
|
|
||||||
Function ReadEnableAutoRecover();
|
|
||||||
Function WriteDoNotPromptForConvert();
|
|
||||||
Function ReadDoNotPromptForConvert();
|
|
||||||
Function ReadDocumentLibraryVersions();
|
|
||||||
Function ReadDocumentInspectors();
|
|
||||||
Function WriteDisplayInkComments();
|
|
||||||
Function ReadDisplayInkComments();
|
|
||||||
Function WriteDisplayDrawingObjects();
|
|
||||||
Function ReadDisplayDrawingObjects();
|
|
||||||
Function WriteDefaultTimelineStyle();
|
|
||||||
Function ReadDefaultTimelineStyle();
|
|
||||||
Function WriteDefaultTableStyle();
|
|
||||||
Function ReadDefaultTableStyle();
|
|
||||||
Function WriteDefaultSlicerStyle();
|
|
||||||
Function ReadDefaultSlicerStyle();
|
|
||||||
Function WriteDefaultPivotTableStyle();
|
|
||||||
Function ReadDefaultPivotTableStyle();
|
|
||||||
Function WriteDate1904();
|
|
||||||
Function ReadDate1904();
|
|
||||||
Function ReadCustomXMLParts();
|
|
||||||
Function ReadCustomViews();
|
|
||||||
Function WriteCustomDocumentProperties(value);
|
|
||||||
Function ReadCustomDocumentProperties(item);
|
|
||||||
Function ReadCreator();
|
|
||||||
Function ReadCreateBackup();
|
|
||||||
Function ReadContentTypeProperties();
|
|
||||||
Function ReadContainer;
|
|
||||||
Function ReadConnectionsDisabled();
|
|
||||||
Function ReadConnections();
|
|
||||||
Function WriteConflictResolution();
|
|
||||||
Function ReadConflictResolution();
|
|
||||||
Function ReadCommandBars();
|
|
||||||
Function WriteColors(index, value);
|
|
||||||
Function ReadColors(index);
|
|
||||||
Function ReadCodeName();
|
|
||||||
Function ReadCheckCompatibility();
|
|
||||||
Function WriteCheckCompatibility();
|
|
||||||
Function ReadCharts();
|
|
||||||
Function ReadChartDataPointTrack();
|
|
||||||
Function WriteChartDataPointTrack();
|
|
||||||
Function WirteChangeHistoryDuration();
|
|
||||||
Function ReadChangeHistoryDuration();
|
|
||||||
Function ReadCaseSensitive();
|
|
||||||
Function ReadCalculationVersion();
|
|
||||||
Function ReadBuiltinDocumentProperties();
|
|
||||||
Function ReadAutoUpdateSaveChanges();
|
|
||||||
Function WriteAutoUpdateSaveChanges();
|
|
||||||
Function ReadAutoSaveOn();
|
|
||||||
Function WriteAutoSaveOn();
|
|
||||||
Function ReadApplication();
|
|
||||||
Function ReadActiveSlicer();
|
|
||||||
Function ReadActiveSheet();
|
|
||||||
Function ReadActiveChart();
|
|
||||||
Function ReadAccuracyVersion();
|
|
||||||
Function WriteAccuracyVersion(value);
|
|
||||||
|
|
||||||
private
|
|
||||||
worksheets_;
|
|
||||||
|
|
||||||
End;
|
|
||||||
|
|
||||||
// ============== 实现 ================= //
|
|
||||||
Function Workbook.Create(object, name, fullname);
|
|
||||||
Begin
|
|
||||||
xlsx_ := object;
|
|
||||||
file_name_ := name;
|
|
||||||
full_name_ := fullname;
|
|
||||||
collection_ := class(Collection).GetInstance('workbook');
|
|
||||||
Init(object);
|
|
||||||
End;
|
|
||||||
|
|
||||||
Function Workbook.Init(object);
|
|
||||||
Begin
|
|
||||||
worksheets_ := new Worksheets(object, file_name_);
|
|
||||||
End;
|
|
||||||
|
|
||||||
// function
|
|
||||||
Function Workbook.Close(SaveChanges, FileName, RouteWorkbook);
|
|
||||||
Begin
|
|
||||||
if SaveChanges then xlsx_.Save();
|
|
||||||
if FileName then xlsx_.SaveAs("", FileName);
|
|
||||||
collection_.RemoveCollection(file_name_);
|
|
||||||
End;
|
|
||||||
|
|
||||||
Function Workbook.Save();
|
|
||||||
Begin
|
|
||||||
xlsx_.Save();
|
|
||||||
End;
|
|
||||||
|
|
||||||
Function Workbook.SaveAs(FileName, FileFormat, Password, WriteResPassword, ReadOnlyRecommended,
|
|
||||||
CreateBackup, AccessMode, ConflictResolution, AddToMru, TextCodepage, TextVisualLayout, Local);
|
|
||||||
Begin
|
|
||||||
xlsx_.SetPassword(Password);
|
|
||||||
xlsx_.SaveAs("", FileName);
|
|
||||||
End;
|
|
||||||
|
|
||||||
Function Workbook.SaveCopyAs(FileName);
|
|
||||||
Begin
|
|
||||||
xlsx_.SaveAs("", FileName);
|
|
||||||
End;
|
|
||||||
|
|
||||||
// property
|
|
||||||
Function Workbook.ReadWorkSheets(index);
|
|
||||||
Begin
|
|
||||||
if ifnil(index) then return worksheets_;
|
|
||||||
return worksheets_[index];
|
|
||||||
End;
|
|
||||||
|
|
||||||
Function Workbook.ReadActiveSheet();
|
|
||||||
Begin
|
|
||||||
return worksheets_.GetCollection().GetActivation();
|
|
||||||
End;
|
|
||||||
|
|
||||||
Function Workbook.ReadFullName();
|
|
||||||
Begin
|
|
||||||
return full_name_;
|
|
||||||
End;
|
|
||||||
|
|
||||||
Function Workbook.ReadFullNameURLEncoded();
|
|
||||||
Begin
|
|
||||||
return full_name_;
|
|
||||||
End;
|
|
||||||
|
|
||||||
Function Workbook.ReadName();
|
|
||||||
Begin
|
|
||||||
return file_name_;
|
|
||||||
End;
|
|
||||||
|
|
||||||
Function Workbook.WritePassword(passwd);
|
|
||||||
Begin
|
|
||||||
xlsx_.SetPassword(passwd);
|
|
||||||
End;
|
|
||||||
|
|
||||||
Function Workbook.ReadPassword();
|
|
||||||
Begin
|
|
||||||
return "******";
|
|
||||||
End;
|
|
||||||
|
|
||||||
Function Workbook.ReadPath();
|
|
||||||
Begin
|
|
||||||
return ExtractFileDir(full_name_);
|
|
||||||
End;
|
|
||||||
|
|
@ -1,81 +0,0 @@
|
||||||
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;
|
|
||||||
|
|
||||||
|
|
@ -1,96 +0,0 @@
|
||||||
Type Worksheet = class
|
|
||||||
|
|
||||||
public
|
|
||||||
Function Create(obj, sheet_name, collection);
|
|
||||||
|
|
||||||
private
|
|
||||||
xlsx_;
|
|
||||||
sheet_name_;
|
|
||||||
collection_;
|
|
||||||
|
|
||||||
private
|
|
||||||
Function CalSheetName();
|
|
||||||
|
|
||||||
public
|
|
||||||
Function Activate(); // Completed
|
|
||||||
Function Copy(arr); // Completed
|
|
||||||
Function Calculate();
|
|
||||||
Function ChartObjects();
|
|
||||||
Function CheckSpelling();
|
|
||||||
Function CircleInvalid();
|
|
||||||
Function ClearArrows();
|
|
||||||
Function Delete();
|
|
||||||
Function Evaluate();
|
|
||||||
Function ExportAsFixedFormat();
|
|
||||||
Function Move();
|
|
||||||
Function OLEObjects();
|
|
||||||
Function Paste();
|
|
||||||
Function PasteSpecial();
|
|
||||||
Function PivotTables();
|
|
||||||
Function PivotTableWizard();
|
|
||||||
Function PrintOut();
|
|
||||||
Function PrintPreview();
|
|
||||||
Function Protect();
|
|
||||||
Function ResetAllPageBreaks();
|
|
||||||
Function SaveAs();
|
|
||||||
Function Scenarios();
|
|
||||||
Function Select();
|
|
||||||
Function SetBackgroundPicture();
|
|
||||||
Function ShowAllData();
|
|
||||||
Function ShowDataForm();
|
|
||||||
Function UnProtect();
|
|
||||||
Function XmlDataQuery();
|
|
||||||
Function XmlMapQuery();
|
|
||||||
|
|
||||||
// VBA Property
|
|
||||||
property Visible write WriteVisible;
|
|
||||||
property Name read ReadName write WriteName;
|
|
||||||
Function WriteVisible(value);
|
|
||||||
Function WriteName(new_name);
|
|
||||||
Function ReadName();
|
|
||||||
|
|
||||||
End;
|
|
||||||
|
|
||||||
// ============== 实现 ================= //
|
|
||||||
Function Worksheet.Create(obj, sheet_name, collection);
|
|
||||||
Begin
|
|
||||||
xlsx_ := obj;
|
|
||||||
sheet_name_ := sheet_name;
|
|
||||||
collection_ := collection;
|
|
||||||
End;
|
|
||||||
|
|
||||||
Function Worksheet.CalSheetName();
|
|
||||||
Begin
|
|
||||||
count := xlsx_.GetSheetsCount();
|
|
||||||
sheets := xlsx_.GetSheets();
|
|
||||||
name := "Sheet" $ count;
|
|
||||||
while name in sheets do
|
|
||||||
name := "Sheet" $ ++count;
|
|
||||||
return name;
|
|
||||||
End;
|
|
||||||
|
|
||||||
Function Worksheet.Activate();
|
|
||||||
Begin
|
|
||||||
collection_.SetActivation(sheet_name_);
|
|
||||||
return xlsx_.SetDefaultSheet(sheet_name_);
|
|
||||||
End;
|
|
||||||
|
|
||||||
Function Worksheet.Copy(arr);
|
|
||||||
Begin
|
|
||||||
if not istable(arr) then return xlsx_.CopySheet(self.Name, CalSheetName());
|
|
||||||
End;
|
|
||||||
|
|
||||||
Function Worksheet.WriteVisible(value);
|
|
||||||
Begin
|
|
||||||
return xlsx_.SetSheetVisible(sheet_name_, value);
|
|
||||||
End;
|
|
||||||
|
|
||||||
Function Worksheet.WriteName(new_name);
|
|
||||||
Begin
|
|
||||||
return xlsx_.SetSheetName(sheet_name_, new_name);
|
|
||||||
End;
|
|
||||||
|
|
||||||
Function Worksheet.ReadName();
|
|
||||||
Begin
|
|
||||||
return sheet_name_;
|
|
||||||
End;
|
|
||||||
|
|
@ -1,66 +0,0 @@
|
||||||
Type Worksheets = class
|
|
||||||
|
|
||||||
public
|
|
||||||
Function Create(object, name);
|
|
||||||
Function Init();
|
|
||||||
Function Operator[](index);
|
|
||||||
Function GetCollection();
|
|
||||||
|
|
||||||
private
|
|
||||||
xlsx_;
|
|
||||||
collection_;
|
|
||||||
|
|
||||||
public
|
|
||||||
Function Add();
|
|
||||||
Function Add2();
|
|
||||||
Function Copy();
|
|
||||||
Function Delete();
|
|
||||||
Function FillAcrossSheets();
|
|
||||||
Function Move();
|
|
||||||
Function PrintOut();
|
|
||||||
Function PrintPreview();
|
|
||||||
Function Select();
|
|
||||||
|
|
||||||
property worksheet read ReadWorksheet;
|
|
||||||
property Count read ReadCount;
|
|
||||||
Function ReadWorksheet(index);
|
|
||||||
Function ReadCount();
|
|
||||||
|
|
||||||
End;
|
|
||||||
|
|
||||||
// ============== 实现 ================= //
|
|
||||||
Function Worksheets.Create(object, name);
|
|
||||||
Begin
|
|
||||||
xlsx_ := object;
|
|
||||||
collection_ := class(Collection).GetInstance(name $ "worksheet");
|
|
||||||
collection_.SetIgnoreCase(true);
|
|
||||||
Init();
|
|
||||||
End;
|
|
||||||
|
|
||||||
Function Worksheets.Init();
|
|
||||||
Begin
|
|
||||||
sheets := xlsx_.GetSheets();
|
|
||||||
for k, v in sheets do
|
|
||||||
collection_.AddCollection(new Worksheet(xlsx_, v, collection_), v);
|
|
||||||
collection_.SetActivation(xlsx_.GetDefaultSheet());
|
|
||||||
End;
|
|
||||||
|
|
||||||
Function Operator Worksheets.[](index);
|
|
||||||
Begin
|
|
||||||
return collection_[index];
|
|
||||||
End;
|
|
||||||
|
|
||||||
Function Worksheets.ReadWorksheet(index);
|
|
||||||
Begin
|
|
||||||
return collection_[index];
|
|
||||||
End;
|
|
||||||
|
|
||||||
Function Worksheets.ReadCount();
|
|
||||||
Begin
|
|
||||||
return collection_.GetCount();
|
|
||||||
End;
|
|
||||||
|
|
||||||
Function Worksheets.GetCollection();
|
|
||||||
Begin
|
|
||||||
return collection_;
|
|
||||||
End;
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
||||||
Type XlsxApplication = class
|
|
||||||
|
|
||||||
public
|
|
||||||
Function Create();
|
|
||||||
Function Init();
|
|
||||||
|
|
||||||
public
|
|
||||||
property Workbooks read ReadWorkbooks; // Completed
|
|
||||||
Function ReadWorkbooks(index);
|
|
||||||
|
|
||||||
private
|
|
||||||
workbooks_;
|
|
||||||
|
|
||||||
End;
|
|
||||||
|
|
||||||
// ============== 实现 ================= //
|
|
||||||
Function XlsxApplication.Create();
|
|
||||||
Begin
|
|
||||||
Init();
|
|
||||||
End;
|
|
||||||
|
|
||||||
Function XlsxApplication.Init();
|
|
||||||
Begin
|
|
||||||
workbooks_ := new Workbooks();
|
|
||||||
End;
|
|
||||||
|
|
||||||
Function XlsxApplication.ReadWorkbooks(index)
|
|
||||||
Begin
|
|
||||||
if ifnil(index) then return workbooks_;
|
|
||||||
return workbooks_[index];
|
|
||||||
End;
|
|
||||||
|
|
||||||
Loading…
Reference in New Issue