This commit is contained in:
csh
2023-01-18 16:49:57 +08:00
parent 331317b6f6
commit 3146c3c9c5
19 changed files with 1334 additions and 73 deletions
+36 -3
View File
@@ -344,9 +344,18 @@ println("[success] MergeCell");
excel.UnMergeCell(sheetName2, "A4", "C4");
println("[success] UnMergeCell");
// TODO 未完全开发完毕
// SetSheetViewOptions
sheetView := TOfficeObj('TSheetView');
sheetView.ShowGridLines := false;
sheetView.ShowRowColHeaders := false;
sheetView.View := 'pageBreakPreview';
sheetView.ZoomScale := 60;
excel.SetSheetViewOptions(sheetName, 0, sheetView);
println("[success] SetSheetViewOptions");
// GetSheetViewOptions
view := excel.GetSheetViewOptions(sheetName, 0);
println("[success] GetSheetViewOptions ShowGridLines = {}, ShowRowColHeaders = {}, View = {}, ZoomScale = {}", view.ShowGridLines, view.ShowRowColHeaders, view.ZoomScale, view.View);
// SetPageLayout
pageLayout := TOfficeObj('TPageLayout');
@@ -441,8 +450,8 @@ shape_format.EndColOff := 7653;
shape_format.BegRowOff := 55577;
shape_format.EndRowOff := 66675;
shape_type := "roundRect";
//excel.AddShape(sheetName2, "A15", "C17", shape_type, shape_format);
//println("[success] AddShape");
excel.AddShape(sheetName2, "A15", "C17", shape_type, shape_format);
println("[success] AddShape");
// SetCoreProps
core := TOfficeObj('TCoreProperty');
@@ -473,6 +482,30 @@ println("[success] SetAppProps");
app_props := excel.GetAppProps();
println("[success] GetAppProps Manager = {}, Company = {}, Application = {}", app_props.Manager, app_props.Company, app_props.Application);
// CopySheet
excel.CopySheet(sheetName2, 'copy');
println("[success] CopySheet");
// ProtectSheet
protect := TOfficeObj('TProtect');
protect.EditObjects := true;
protect.EditScenarios := true;
protect.FormatCells := true;
protect.FormatColumns := true;
protect.FormatRows := true;
protect.InsertColumns := true;
protect.InsertRows := true;
protect.InsertHyperlinks := true;
protect.DeleteColumns := true;
protect.DeleteRows := true;
protect.Sort := true;
protect.AutoFilter := true;
protect.PivotTables := true;
protect.SelectLockedCells := true;
protect.SelectUnLockedCells := true;
excel.ProtectSheet(sheetName2, protect);
println("[success] ProtectSheet");
[err, errmsg] := excel.saveas("", "d:\\temp\\test.xlsx");
println("saveas : {}", err);