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
+30
View File
@@ -717,5 +717,35 @@ style.Protection.Lock := 1;
),
'Demo': '',
),
('ObjName': 'TProtect',
'Desc': ('TProtect有以下属性: '),
'AttrInfo': (
('attrName': 'EditObjects', 'type': 'bool', 'desc': '编辑方案', 'value': array()),
('attrName': 'EditScenarios', 'type': 'bool', 'desc': '编辑方案', 'value': array()),
('attrName': 'FormatCells', 'type': 'bool', 'desc': '设置单元格格式', 'value': array()),
('attrName': 'FormatColumns', 'type': 'bool', 'desc': '设置列格式', 'value': array()),
('attrName': 'FormatRows', 'type': 'bool', 'desc': '设置行格式', 'value': array()),
('attrName': 'InsertColumns', 'type': 'bool', 'desc': '插入行', 'value': array()),
('attrName': 'InsertRows', 'type': 'bool', 'desc': '插入列', 'value': array()),
('attrName': 'InsertHyperlinks', 'type': 'bool', 'desc': '插入超链接', 'value': array()),
('attrName': 'DeleteColumns', 'type': 'bool', 'desc': '删除列', 'value': array()),
('attrName': 'DeleteRows', 'type': 'bool', 'desc': '删除行', 'value': array()),
('attrName': 'SelectLockedCells', 'type': 'bool', 'desc': '选定锁定的单元格', 'value': array()),
('attrName': 'Sort', 'type': 'bool', 'desc': '排序', 'value': array()),
('attrName': 'AutoFilter', 'type': 'bool', 'desc': '使用自动筛选', 'value': array()),
('attrName': 'PivotTables', 'type': 'bool', 'desc': '使用自动透视表和自动透视图', 'value': array()),
),
'Demo': '',
),
('ObjName': 'TSheetView',
'Desc': ('TSheetView有以下属性: '),
'AttrInfo': (
('attrName': 'ShowGridLines', 'type': 'bool', 'desc': '网格线', 'value': array()),
('attrName': 'ShowRowColHeaders', 'type': 'bool', 'desc': '标题', 'value': array()),
('attrName': 'View', 'type': 'string', 'desc': '工作簿视图', 'value': array('"pageBreakPreview": 分页预览')),
('attrName': 'ZoomScale', 'type': 'bool', 'desc': '缩放比例(%)', 'value': array()),
),
'Demo': '',
),
);
End
+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);