97 lines
2.0 KiB
Plaintext
97 lines
2.0 KiB
Plaintext
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;
|