diff --git a/Demo/ExcelHelp.tsl b/Demo/ExcelHelp.tsl index 548f55d..8c043d6 100644 --- a/Demo/ExcelHelp.tsl +++ b/Demo/ExcelHelp.tsl @@ -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 diff --git a/Demo/excel_demo.tsl b/Demo/excel_demo.tsl index c814811..1197493 100644 --- a/Demo/excel_demo.tsl +++ b/Demo/excel_demo.tsl @@ -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); diff --git a/DocxFile使用帮助.docx b/DocxFile使用帮助.docx index 6bd70fe..433d148 100644 Binary files a/DocxFile使用帮助.docx and b/DocxFile使用帮助.docx differ diff --git a/ExcelFile使用帮助.xlsx b/ExcelFile使用帮助.xlsx index 65465b3..341a55b 100644 Binary files a/ExcelFile使用帮助.xlsx and b/ExcelFile使用帮助.xlsx differ diff --git a/Linux-aarch64/liboffice_plugin.so b/Linux-aarch64/liboffice_plugin.so index abf7e7f..edadff3 100644 Binary files a/Linux-aarch64/liboffice_plugin.so and b/Linux-aarch64/liboffice_plugin.so differ diff --git a/Linux-x86_64/liboffice_plugin.so b/Linux-x86_64/liboffice_plugin.so index 4649b98..c76ffdc 100644 Binary files a/Linux-x86_64/liboffice_plugin.so and b/Linux-x86_64/liboffice_plugin.so differ diff --git a/Windows-X64/office_plugin.dll b/Windows-X64/office_plugin.dll index 375b71d..469bad2 100644 Binary files a/Windows-X64/office_plugin.dll and b/Windows-X64/office_plugin.dll differ diff --git a/funcext/TSOffice/TOfficeObj.tsf b/funcext/TSOffice/TOfficeObj.tsf index c98a3b4..54652c6 100644 --- a/funcext/TSOffice/TOfficeObj.tsf +++ b/funcext/TSOffice/TOfficeObj.tsf @@ -1,4 +1,4 @@ -// Version 1.1.0 +// Version 1.1.1 Function TOfficeObj(n); Begin @@ -303,6 +303,8 @@ Begin return new TTableStyle(); "tbreak": return new TBreak(); + "tprotect": + return new TProtect(); End; End; @@ -326,6 +328,11 @@ type TFont=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -411,6 +418,12 @@ type TComment=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + Font.InitRootNode(node); + End; + Property Text read readXMLText write writeXMLText; Function readXMLText(); Begin @@ -467,6 +480,11 @@ type TComments=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -523,6 +541,11 @@ type TRichText=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -573,6 +596,11 @@ type TxdrFromTo=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -618,6 +646,11 @@ type TOff=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -657,6 +690,11 @@ type TExt=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -698,6 +736,13 @@ type TXfrm=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + Off.InitRootNode(node); + Ext.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -740,6 +785,11 @@ type TClientData=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -790,6 +840,11 @@ type TGraphicFramePr=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -836,6 +891,14 @@ type TGraphicFrame=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + GraphicFramePr.InitRootNode(node); + Xfrm.InitRootNode(node); + Graphic.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -885,6 +948,16 @@ type TtwoCellAnchor=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + XFrom.InitRootNode(node); + XTo.InitRootNode(node); + GraphicFrame.InitRootNode(node); + Pic.InitRootNode(node); + ClientData.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -933,6 +1006,11 @@ type TcNvPicPr=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -976,6 +1054,11 @@ type TPictureFormat=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -1021,6 +1104,11 @@ type TShapeFormat=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -1083,6 +1171,15 @@ type TChartImpl=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + XAxis.InitRootNode(node); + YAxis.InitRootNode(node); + Legend.InitRootNode(node); + Plotarea.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -1192,6 +1289,11 @@ type TLegend=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -1248,6 +1350,13 @@ type TChartAxis=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + NumFont.InitRootNode(node); + NameLayout.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -1325,6 +1434,11 @@ type TNumFont=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -1370,6 +1484,11 @@ type TNameLayout=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -1415,6 +1534,11 @@ type Tpt=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -1456,6 +1580,12 @@ type TStrCache=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + Pt.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -1498,6 +1628,12 @@ type TStrRef=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + StrCache.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -1540,6 +1676,12 @@ type TcCat=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + StrRef.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -1580,6 +1722,12 @@ type TNumCache=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + Pt.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -1624,6 +1772,12 @@ type TNumRef=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + NumCache.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -1666,6 +1820,12 @@ type TcVal=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + NumRef.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -1706,6 +1866,12 @@ type TTx=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + StrRef.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -1746,6 +1912,12 @@ type TSolidFill=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + SchemeClr.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -1787,6 +1959,11 @@ type TSchemeClr=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -1830,6 +2007,12 @@ type TLn=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + SolidFill.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -1880,6 +2063,12 @@ type TContourClr=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + SchemeClr.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -1920,6 +2109,12 @@ type TSp3D=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + ContourClr.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -1965,6 +2160,16 @@ type TspPr=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + SolidFill.InitRootNode(node); + Ln.InitRootNode(node); + Sp3D.InitRootNode(node); + XFrm.InitRootNode(node); + PrstGeom.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -2017,6 +2222,12 @@ type TDpt=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + SpPr.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -2061,6 +2272,12 @@ type TMarker=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + SpPr.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -2115,6 +2332,21 @@ type TSer=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + Tx.InitRootNode(node); + SpPr.InitRootNode(node); + DPt.InitRootNode(node); + DLbls.InitRootNode(node); + Marker.InitRootNode(node); + Cat.InitRootNode(node); + Val.InitRootNode(node); + XVal.InitRootNode(node); + YVal.InitRootNode(node); + BubbleSize.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -2184,6 +2416,11 @@ type TdLbls=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -2239,6 +2476,12 @@ type TcCharts=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + DLbls.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -2312,6 +2555,11 @@ type TcScaling=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -2358,6 +2606,12 @@ type TcChartLines=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + SpPr.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -2397,6 +2651,11 @@ type TcNumFmt=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -2437,6 +2696,12 @@ type TaR=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + Rpr.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -2478,6 +2743,11 @@ type TaEndParaRPr=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -2521,6 +2791,14 @@ type TaP=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + Ppr.InitRootNode(node); + R.InitRootNode(node); + EndParaRPr.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -2565,6 +2843,12 @@ type TaPPr=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + DefRPr.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -2605,6 +2889,11 @@ type TaLatin=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -2646,6 +2935,11 @@ type TaEa=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -2684,6 +2978,11 @@ type TaCs=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -2726,6 +3025,15 @@ type TaRPr=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + SolidFill.InitRootNode(node); + Latin.InitRootNode(node); + Ea.InitRootNode(node); + Cs.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -2790,6 +3098,11 @@ type TaBodyPr=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -2848,6 +3161,13 @@ type TTxPr=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + BodyPr.InitRootNode(node); + P.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -2897,6 +3217,17 @@ type TcAxs=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + Scaling.InitRootNode(node); + MajorGridlines.InitRootNode(node); + MinorGridlines.InitRootNode(node); + NumFmt.InitRootNode(node); + SpPr.InitRootNode(node); + TxPr.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -2985,6 +3316,16 @@ type TplotArea=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + Chart.InitRootNode(node); + CatAx.InitRootNode(node); + ValAx.InitRootNode(node); + SerAx.InitRootNode(node); + SpPr.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -3034,6 +3375,11 @@ type TView3D=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -3081,6 +3427,11 @@ type TBorder=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -3134,6 +3485,16 @@ type TBorders=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + Left.InitRootNode(node); + Right.InitRootNode(node); + Top.InitRootNode(node); + Bottom.InitRootNode(node); + Diagonal.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -3185,6 +3546,11 @@ type TNumFmts=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -3226,6 +3592,13 @@ type TFills=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + Pattern.InitRootNode(node); + Gradient.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -3267,6 +3640,11 @@ type TGradientImpl=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -3309,6 +3687,11 @@ type TPattern=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -3359,6 +3742,11 @@ type TStop=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -3403,6 +3791,11 @@ type TAlignment=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -3444,6 +3837,11 @@ type TProtection=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -3489,6 +3887,17 @@ type TStyle=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + Border.InitRootNode(node); + Font.InitRootNode(node); + NumberFormat.InitRootNode(node); + Fill.InitRootNode(node); + Alignment.InitRootNode(node); + Protection.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -3540,6 +3949,13 @@ type TXf=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + Alignment.InitRootNode(node); + Protection.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -3591,6 +4007,11 @@ type THeaderFooter=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -3650,6 +4071,11 @@ type TMargins=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -3693,6 +4119,11 @@ type THyperLink=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Property LinkUrl read readXMLLinkUrl write writeXMLLinkUrl; Function readXMLLinkUrl(); Begin @@ -3789,10 +4220,106 @@ type TSheetView=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + + Property ShowGridLines read readXMLShowGridLines write writeXMLShowGridLines; + Function readXMLShowGridLines(); + Begin + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('ShowGridLines')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLShowGridLines); + End; + + Function writeXMLShowGridLines(str); + Begin + XMLShowGridLines := class(TSXml).CurCodePageToUtf8(str); + End; + + Property ShowRowColHeaders read readXMLShowRowColHeaders write writeXMLShowRowColHeaders; + Function readXMLShowRowColHeaders(); + Begin + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('ShowRowColHeaders')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLShowRowColHeaders); + End; + + Function writeXMLShowRowColHeaders(str); + Begin + XMLShowRowColHeaders := class(TSXml).CurCodePageToUtf8(str); + End; + + Property TabSelected read readXMLTabSelected write writeXMLTabSelected; + Function readXMLTabSelected(); + Begin + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('TabSelected')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLTabSelected); + End; + + Function writeXMLTabSelected(str); + Begin + XMLTabSelected := class(TSXml).CurCodePageToUtf8(str); + End; + + Property View read readXMLView write writeXMLView; + Function readXMLView(); + Begin + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('View')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLView); + End; + + Function writeXMLView(str); + Begin + XMLView := class(TSXml).CurCodePageToUtf8(str); + End; + + Property ZoomScale read readXMLZoomScale write writeXMLZoomScale; + Function readXMLZoomScale(); + Begin + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('ZoomScale')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLZoomScale); + End; + + Function writeXMLZoomScale(str); + Begin + XMLZoomScale := class(TSXml).CurCodePageToUtf8(str); + End; + + Property ZoomScaleNormal read readXMLZoomScaleNormal write writeXMLZoomScaleNormal; + Function readXMLZoomScaleNormal(); + Begin + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('ZoomScaleNormal')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLZoomScaleNormal); + End; + + Function writeXMLZoomScaleNormal(str); + Begin + XMLZoomScaleNormal := class(TSXml).CurCodePageToUtf8(str); + End; + + Property WorkbookViewId read readXMLWorkbookViewId write writeXMLWorkbookViewId; + Function readXMLWorkbookViewId(); + Begin + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('WorkbookViewId')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLWorkbookViewId); + End; + + Function writeXMLWorkbookViewId(str); + Begin + XMLWorkbookViewId := class(TSXml).CurCodePageToUtf8(str); + End; + Function GetAttrs(); override; Begin HandleAttrs(); - return array(("ShowGridLines", "showGridLines", ShowGridLines, ""),("ShowRowColHeaders", "showRowColHeaders", ShowRowColHeaders, ""),("ZoomScale", "zoomScale", ZoomScale, ""),("ZoomScaleNormal", "zoomScaleNormal", ZoomScaleNormal, "")) union ExtAttr; + return array(("ShowGridLines", "showGridLines", XMLShowGridLines, ""),("ShowRowColHeaders", "showRowColHeaders", XMLShowRowColHeaders, ""),("TabSelected", "tabSelected", XMLTabSelected, ""),("View", "view", XMLView, ""),("ZoomScale", "zoomScale", XMLZoomScale, ""),("ZoomScaleNormal", "zoomScaleNormal", XMLZoomScaleNormal, ""),("WorkbookViewId", "workbookViewId", XMLWorkbookViewId, "")) union ExtAttr; End; Function GetChildren(); override; @@ -3802,10 +4329,13 @@ type TSheetView=class(NodeInfo) End; //Attributes - ShowGridLines; - ShowRowColHeaders; - ZoomScale; - ZoomScaleNormal; + XMLShowGridLines; + XMLShowRowColHeaders; + XMLTabSelected; + XMLView; + XMLZoomScale; + XMLZoomScaleNormal; + XMLWorkbookViewId; //Nodes End; @@ -3830,6 +4360,11 @@ type TPageLayout=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -3879,6 +4414,11 @@ type TAppProperty=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Property Application read readXMLApplication write writeXMLApplication; Function readXMLApplication(); Begin @@ -4066,6 +4606,11 @@ type TCoreProperty=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Property Title read readXMLTitle write writeXMLTitle; Function readXMLTitle(); Begin @@ -4238,6 +4783,11 @@ type TBr=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -4276,6 +4826,11 @@ type TwFont=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Property eastAsia read readXMLeastAsia write writeXMLeastAsia; Function readXMLeastAsia(); Begin @@ -4441,6 +4996,13 @@ type TwrPr=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + rFont.InitRootNode(node); + Del.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -4529,6 +5091,11 @@ type TNumPr=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -4571,6 +5138,12 @@ type TTextBoxImpl=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + P.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -4614,6 +5187,15 @@ type TwpPr=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + NumPr.InitRootNode(node); + Tabs.InitRootNode(node); + rPr.InitRootNode(node); + Bdr.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -4717,6 +5299,11 @@ type TcNvGraphicFramePr=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -4760,6 +5347,13 @@ type TnvPicPr=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + CNvPr.InitRootNode(node); + CNvPicPr.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -4804,6 +5398,12 @@ type TCNvPr=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + ExtLst.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -4847,6 +5447,12 @@ type TExtLst=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + Ext.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -4886,6 +5492,11 @@ type TAext=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -4928,6 +5539,11 @@ type TprstGeom=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -4970,6 +5586,13 @@ type TblipFill=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + Blip.InitRootNode(node); + Stretch.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -5012,6 +5635,12 @@ type TwLine=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + SolidFill.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -5054,6 +5683,14 @@ type TpicsPpr=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + XFrm.InitRootNode(node); + PrstGeom.InitRootNode(node); + Line.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -5097,6 +5734,11 @@ type TBlip=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -5137,6 +5779,11 @@ type TStretch=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -5177,6 +5824,12 @@ type TRef=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + SchemeClr.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -5217,6 +5870,11 @@ type TScheme=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -5261,6 +5919,15 @@ type TXdrStyle=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + LnRef.InitRootNode(node); + FillRef.InitRootNode(node); + EffectRef.InitRootNode(node); + FontRef.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -5311,6 +5978,16 @@ type TPic=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + NvPicPr.InitRootNode(node); + BlipFill.InitRootNode(node); + SpPr.InitRootNode(node); + Style.InitRootNode(node); + TxBody.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -5362,6 +6039,12 @@ type TGraphicData=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + Pic.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -5409,6 +6092,12 @@ type TGraphic=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + GraphicData.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -5451,6 +6140,13 @@ type TwInline=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + cNvGraphicFramePr.InitRootNode(node); + Graphic.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -5515,6 +6211,12 @@ type TwDrawing=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + WInline.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -5554,6 +6256,11 @@ type TText=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -5597,6 +6304,14 @@ type TRunImpl=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + rPr.InitRootNode(node); + Br.InitRootNode(node); + Drawing.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -5656,6 +6371,11 @@ type TBookMark=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -5696,6 +6416,12 @@ type TFldSimple=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + Run.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -5743,6 +6469,18 @@ type TParagraphImpl=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + pPr.InitRootNode(node); + markStart.InitRootNode(node); + Run.InitRootNode(node); + markEnd.InitRootNode(node); + PageNo.InitRootNode(node); + OfRun.InitRootNode(node); + TotalPageNo.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -5795,6 +6533,11 @@ type TwBody=class(NodeInfo, TDocumentBody) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -5834,6 +6577,11 @@ type TOptInfo=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Property Author read readXMLAuthor write writeXMLAuthor; Function readXMLAuthor(); Begin @@ -5887,6 +6635,11 @@ type TRevisionImpl=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Property Author read readXMLAuthor write writeXMLAuthor; Function readXMLAuthor(); Begin @@ -5941,6 +6694,12 @@ type TDocCommentImpl=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + P.InitRootNode(node); + End; + Property Author read readXMLAuthor write writeXMLAuthor; Function readXMLAuthor(); Begin @@ -5996,6 +6755,11 @@ type TCol=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -6036,6 +6800,11 @@ type TCols=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -6079,6 +6848,11 @@ type TPageMargin=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -6123,6 +6897,11 @@ type TDocGrid=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -6164,6 +6943,11 @@ type TReference=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -6207,6 +6991,15 @@ type TPageBorders=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + Top.InitRootNode(node); + Left.InitRootNode(node); + Bottom.InitRootNode(node); + Right.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -6253,6 +7046,11 @@ type TPage=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -6303,6 +7101,18 @@ type TDocSectionImpl=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + Header.InitRootNode(node); + Footer.InitRootNode(node); + cols.InitRootNode(node); + docGrid.InitRootNode(node); + pgMar.InitRootNode(node); + Page.InitRootNode(node); + Borders.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -6364,6 +7174,11 @@ type TcellMerge=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Property Author read readXMLAuthor write writeXMLAuthor; Function readXMLAuthor(); Begin @@ -6425,6 +7240,17 @@ type TwTcPr=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + Shading.InitRootNode(node); + CellMar.InitRootNode(node); + Borders.InitRootNode(node); + Del.InitRootNode(node); + Ins.InitRootNode(node); + cellMerge.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -6498,6 +7324,13 @@ type TwTc=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + TcPr.InitRootNode(node); + P.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -6540,6 +7373,12 @@ type TwTrPr=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + Del.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -6597,6 +7436,11 @@ type TwShading=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -6643,6 +7487,11 @@ type TTblCellMar=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -6699,6 +7548,14 @@ type TTblPrEx=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + Borders.InitRootNode(node); + Shading.InitRootNode(node); + CellMar.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -6775,6 +7632,13 @@ type TwTr=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + tblPrEx.InitRootNode(node); + TrPr.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -6818,6 +7682,11 @@ type TwBorder=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -6871,6 +7740,18 @@ type TwTblBorders=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + Top.InitRootNode(node); + Left.InitRootNode(node); + Bottom.InitRootNode(node); + Right.InitRootNode(node); + InsideH.InitRootNode(node); + InsideV.InitRootNode(node); + tr2bl.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -6922,6 +7803,11 @@ type TwTblpPr=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -6973,6 +7859,15 @@ type TwTblPr=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + Shading.InitRootNode(node); + Borders.InitRootNode(node); + CellMar.InitRootNode(node); + tblpPr.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -7050,6 +7945,11 @@ type TwGridCol=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -7089,6 +7989,11 @@ type TwTblGrid=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -7131,6 +8036,13 @@ type TTableImpl=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + TblPr.InitRootNode(node); + TblGrid.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -7174,6 +8086,11 @@ type TCorePropertiesImpl=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -7213,6 +8130,13 @@ type TPictureImpl=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + pPr.InitRootNode(node); + Run.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -7259,6 +8183,16 @@ type TpBdr=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + top.InitRootNode(node); + left.InitRootNode(node); + bottom.InitRootNode(node); + right.InitRootNode(node); + bar.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -7306,6 +8240,11 @@ type TLatentStyle=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -7355,6 +8294,16 @@ type TtblStylePr=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + pPr.InitRootNode(node); + rPr.InitRootNode(node); + TrPr.InitRootNode(node); + TblPr.InitRootNode(node); + TcPr.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -7408,6 +8357,17 @@ type TDocxStyleImpl=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + TblStyle.InitRootNode(node); + pPr.InitRootNode(node); + rPr.InitRootNode(node); + TrPr.InitRootNode(node); + TblPr.InitRootNode(node); + TcPr.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -7493,6 +8453,11 @@ type TDocPartObj=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -7536,6 +8501,13 @@ type TStdPr=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + rPr.InitRootNode(node); + docPartObj.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -7580,6 +8552,12 @@ type TStdEndPr=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + rPr.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -7619,6 +8597,11 @@ type TSdtContent=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -7659,6 +8642,14 @@ type TTableContentImpl=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + stdPr.InitRootNode(node); + stdEndPr.InitRootNode(node); + SdtContent.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -7703,6 +8694,11 @@ type TTabStopsImpl=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -7742,6 +8738,11 @@ type TTabStop=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -7782,6 +8783,11 @@ type TNumber=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -7824,6 +8830,13 @@ type TLevel=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + pPr.InitRootNode(node); + rPr.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -7876,6 +8889,12 @@ type TNumStyleImpl=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + lvl.InitRootNode(node); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -7922,6 +8941,11 @@ type TExcelTable=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -7972,6 +8996,11 @@ type TTableStyle=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -8025,6 +9054,11 @@ type TBreak=class(NodeInfo) //TODO... End; + Function InitRootNode(node); + Begin + RootObj := node; + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -8045,6 +9079,64 @@ type TBreak=class(NodeInfo) //Nodes End; +/////////////////////////////////////////////////////////////// +/// TProtect +/////////////////////////////////////////////////////////////// +type TProtect=class(NodeInfo) + Function Create(); overload; + Begin + Create(nil, 'sheetProtection'); + End; + + Function Create(p, name); overload; + Begin + Class(NodeInfo).Create(p, name); + Init(); + End; + + Function Init(); + Begin + //TODO... + End; + + Function InitRootNode(node); + Begin + RootObj := node; + End; + + Function GetAttrs(); override; + Begin + HandleAttrs(); + return array(("Sheet", "sheet", Sheet, ""),("EditObjects", "objects", EditObjects, ""),("EditScenarios", "scenarios", EditScenarios, ""),("FormatCells", "formatCells", FormatCells, ""),("FormatColumns", "formatColumns", FormatColumns, ""),("FormatRows", "formatRows", FormatRows, ""),("InsertColumns", "insertColumns", InsertColumns, ""),("InsertRows", "insertRows", InsertRows, ""),("InsertHyperlinks", "insertHyperlinks", InsertHyperlinks, ""),("DeleteColumns", "deleteColumns", DeleteColumns, ""),("DeleteRows", "deleteRows", DeleteRows, ""),("SelectLockedCells", "selectLockedCells", SelectLockedCells, ""),("Sort", "sort", Sort, ""),("AutoFilter", "autoFilter", AutoFilter, ""),("PivotTables", "pivotTables", PivotTables, ""),("SelectUnLockedCells", "selectUnlockedCells", SelectUnLockedCells, "")) union ExtAttr; + End; + + Function GetChildren(); override; + Begin + HandleChildren(); + return ExtNodes; + End; + + //Attributes + Sheet; + EditObjects; + EditScenarios; + FormatCells; + FormatColumns; + FormatRows; + InsertColumns; + InsertRows; + InsertHyperlinks; + DeleteColumns; + DeleteRows; + SelectLockedCells; + Sort; + AutoFilter; + PivotTables; + SelectUnLockedCells; + + //Nodes +End; + /////////////////////////////////////////////////////////////////////////////////////////// ///DOCX文档实现 @@ -8478,6 +9570,7 @@ Type TRevision = Class(DocObject, TRevisionImpl) End; Date := class(TSXml).GetDatetimeStr(now()); Class(TRevisionImpl).Create(nil, name_); + InitRootNode(node); End; Property InsText read readInsText write writeInsText; @@ -8561,6 +9654,7 @@ Type TDocComment = Class(TDocCommentImpl) name_ := 'w:comment'; Date := class(TSXml).GetDatetimeStr(now()); Class(TDocCommentImpl).Create(nil, name_); + InitRootNode(node); End; ///批注文字内容 @@ -8667,6 +9761,7 @@ Type TParagraph = Class(DocObject, TParagraphImpl) node_ := node; name_ := 'w:p'; Class(TParagraphImpl).Create(nil, 'w:p'); + InitRootNode(node); End; Function Root(); override; @@ -8719,7 +9814,7 @@ Type TParagraph = Class(DocObject, TParagraphImpl) // Function TabStops(); Begin - node := node_.FirstChildElement('w:tabs'); + node := class(TSXml).GetNode(node_, 'w:pPr/w:tabs'); if not ifObj(node) then return nil; return new TTabStops(node); @@ -8776,7 +9871,7 @@ Type TParagraph = Class(DocObject, TParagraphImpl) Function AddRun(txt, newLine); Begin o := new TRun(); - o.Parent := self; + //o.Parent := self; NewChildNode( array("field":"", "name":"w:r", "obj":o, "attrEx":"", "nodeType":"") ); if txt then o.SetText(txt); @@ -8821,6 +9916,14 @@ Type TParagraph = Class(DocObject, TParagraphImpl) box := new TTextBox(node); box.Init(node_, nodeEx); r[length(r)] := box; + End + else Begin + node := class(TSXml).GetNode(runs[i].node_, 'w:pict/v:shape/v:textbox/w:txbxContent'); + if ifObj(node) then Begin + box := new TTextBox(node); + box.Init(node_, nil); + r[length(r)] := box; + End; End; End; return r; @@ -8919,12 +10022,13 @@ Type TTabStops = Class(DocObject, TTabStopsImpl) n := n.NextElement(); End; Tabs := tabArr; + InitRootNode(node); End; End; - Function Create(parentNode, name);overload; + Function Create(parentObj, name);overload; Begin - Class(TTabStopsImpl).Create(parentNode, name); + Class(TTabStopsImpl).Create(parentObj, name); tabArr := array(); End; @@ -9021,6 +10125,7 @@ Type TRun = Class(DocObject, TRunImpl) node_ := node; name_ := 'w:r'; Class(TRunImpl).Create(nil, 'w:r'); + InitRootNode(node); End; Property Font read readFont; @@ -9170,6 +10275,7 @@ Type TPicture = Class(DocObject, TPictureImpl) Width := 0.; Height := Width; Class(TPictureImpl).Create(nil, 'w:p'); + InitRootNode(node); End; Property Format read readFormat; @@ -9268,6 +10374,7 @@ Type TChart = Class(TChartImpl) Class(TChartImpl).Create(nil, 'w:p'); pNode := node; self.C := true; + InitRootNode(node); End; Function Init(docx, node, cNode); @@ -10730,7 +11837,7 @@ Type TDocumentBody = Class(DocObject) p.name_ := 'w:p'; //复制段落字体属性 p.CopyRunFormat(false, nil); - _set_lastParagraph_(p.node_);//设置最后一个段落 + _set_lastParagraph_(posOpt, p.node_);//设置最后一个段落 return p; End; @@ -10855,13 +11962,15 @@ Type TDocumentBody = Class(DocObject) if ifstring(tbl.Data_[i, j]) and Pos('\n', tbl.Data_[i, j]) then multiLine := true; for j:=0 to tbl.colCount_-1 do Begin - //对象太多的话,对象效率奇慢,优化掉 - //tc := new TCell(); - //tc.TcPr.Width := tbl.TblGrid.GridCol[j]['obj'].W; - //tc.TcPr.Type := 'dxa'; - //tc.SetText(tbl.Data_[i, j]); - //trNode.InsertEndChild(tc.Marshal()); - //tc := 0; + //对象太多的话,对象效率奇慢,优化掉(性能可能相差50倍) + if 0 then Begin + tc := new TCell(); + tc.TcPr.Width := tbl.TblGrid.GridCol[j]['obj'].W; + tc.TcPr.Type := 'dxa'; + tc.SetText(tbl.Data_[i, j]); + trNode.InsertEndChild(tc.Marshal()); + continue; + End; tcNode := trNode.InsertEndChild('element', 'w:tc'); tcPrNode := tcNode.InsertEndChild('element', 'w:tcPr'); @@ -10879,7 +11988,7 @@ Type TDocumentBody = Class(DocObject) pNode.InsertEndChild(defaultpPr); rNode := pNode.InsertEndChild('element', 'w:r'); rNode.InsertEndChild(defaultrPr); - tNode := rNode.InsertEndChild('element','w:t', tbl.Data_[i, j]); + tNode := rNode.InsertEndChild('element','w:t', class(TSXml).CurCodePageToUtf8(tbl.Data_[i, j])); if _preserve(tbl.Data_[i, j]) then tNode.SetAttribute('xml:space', 'preserve'); End; @@ -10915,7 +12024,7 @@ Type TDocumentBody = Class(DocObject) End; node_.Parent().SetAttribute('mc:Ignorable', 'w14 w15 wp14'); node_.Parent().SetAttribute('xmlns:w15', 'http://schemas.microsoft.com/office/word/2012/wordml'); - _set_lastParagraph_(tbl.node_); + _set_lastParagraph_(posOpt, tbl.node_); p := new TTable(tbl.node_); return p; @@ -10983,7 +12092,7 @@ Type TDocumentBody = Class(DocObject) addPart(posOpt, picture); p := new TPicture(picture.node_); - _set_lastParagraph_(picture.node_); + _set_lastParagraph_(posOpt, picture.node_); return p; End; @@ -11543,13 +12652,20 @@ Type TDocumentBody = Class(DocObject) return txt; End; - Function _set_lastParagraph_(node); + Function _set_lastParagraph_(posOpt, node); Begin - if not ifObj(lastParagraph_) then Begin + if not ifObj(lastParagraph_) then lastParagraph_ := node; - End - else if node.BigChild(lastParagraph_) then + else if (ifInt(posOpt) and posOpt = -1) then lastParagraph_ := node; + else if ifObj(posOpt) then Begin + posNode := posOpt; + if not (posOpt is Class(XmlNode)) then + posNode := posOpt.Node(); + if lastParagraph_.Eq(posNode) then Begin + _setLastParagraph(); + End; + End; End; zipfile_; @@ -11649,6 +12765,7 @@ Type TDocSection = Class(DocObject, TDocSectionImpl) node_ := node; zipfile_ := z; Class(TDocSectionImpl).Create(nil, name_); + InitRootNode(node); End; ///返回指定页眉 @@ -11793,6 +12910,7 @@ Type TTextBox = Class(TDocumentBody, TTextBoxImpl) Class(TTextBoxImpl).Create(nil, 'w:txbxContent'); Class(TDocumentBody).Create(node); name_ := 'w:txbxContent'; + InitRootNode(node); End; Function Create(pNode, name);overload; @@ -11808,9 +12926,11 @@ Type TTextBox = Class(TDocumentBody, TTextBoxImpl) Function Apply();override; Begin - data := node_.Marshal(); - NodeEx_.DeleteChildren(); - class(TSXml).UpdateNode(NodeEx_, data[0]['attributes'], data[0]['children']); + if ifObj(NodeEx_) then Begin + data := node_.Marshal(); + NodeEx_.DeleteChildren(); + class(TSXml).UpdateNode(NodeEx_, data[0]['attributes'], data[0]['children']); + End; End; pNode_;// @@ -11992,6 +13112,7 @@ Type TTable = Class(DocObject, TTableImpl) iRow ++; row := row.NextElement('w:tr'); End; + InitRootNode(node); End; ///设置表格数据 @@ -12445,6 +13566,7 @@ Type TDocxStyle = Class(TDocxStyleImpl) nameObj := node.FirstChildElement('w:name'); if ifObj(nameObj) then Name := nameObj.GetAttribute('w:val'); + InitRootNode(node); End; End; @@ -12518,6 +13640,7 @@ Type TNumStyle = Class(TNumStyleImpl) fmtNode := class(TSXml).GetNode(node, 'w:lvl/w:numFmt'); if ifObj(fmtNode) then numFmt := fmtNode.GetAttribute('w:val'); + InitRootNode(node); End; End; diff --git a/funcext/TSOffice/TSDocxFile.tsf b/funcext/TSOffice/TSDocxFile.tsf index e04f764..f872d91 100644 --- a/funcext/TSOffice/TSDocxFile.tsf +++ b/funcext/TSOffice/TSDocxFile.tsf @@ -1,4 +1,4 @@ -// Version 1.1.0 +// Version 1.1.1 Type TSDocxFile = Class ///Version: V1.0 2022-09-20 @@ -260,7 +260,7 @@ Type TSDocxFile = Class Function GetCharts();overload; Begin r := array(); - uri := 'w:p/w:r/w:drawing/wp:inline/a:graphic/a:graphicData/c:chart'; + uri := 'w:r/w:drawing/wp:inline/a:graphic/a:graphicData/c:chart'; ps := Paragraphs(); for i:=0 to length(ps)-1 do Begin node := class(TSXml).GetNode(ps[i].node_, uri); diff --git a/funcext/TSOffice/TSExcelFile.tsf b/funcext/TSOffice/TSExcelFile.tsf index b2050ac..693e859 100644 --- a/funcext/TSOffice/TSExcelFile.tsf +++ b/funcext/TSOffice/TSExcelFile.tsf @@ -1,4 +1,4 @@ -// Version 1.1.0 +// Version 1.1.1 Type TSExcelFile = Class ///Version: V1.0 2022-08-08 @@ -615,7 +615,7 @@ Type TSExcelFile = Class ///设置工作表视图属性 ///sheet: string,工作表名称 - ///viewIndex: int,视图索引 + ///viewindex: int,视图索引,viewIndex,从0开始 ///sheet: object,TSheetView对象 Function SetSheetViewOptions(sheet, viewIndex, sheetView); Begin @@ -625,7 +625,6 @@ Type TSExcelFile = Class ///获取工作表视图属性 ///sheet: string,工作表名称 - ///viewindex: int,视图索引,viewIndex 可以是负数,如果是这样,则向后计数(-1 代表最后一个视图) ///返回: object, TSheetView对象 Function GetSheetViewOptions(sheet, viewIndex); Begin @@ -634,7 +633,7 @@ Type TSExcelFile = Class End; // TODO printerSettings1.bin? - ///设置工作表页面设置 + ///设置工作表页面布局 ///sheet: string,工作表名称 ///pageLayout: TPageLayout对象,属性: Function SetPageLayout(sheet, pageLayout); @@ -643,7 +642,7 @@ Type TSExcelFile = Class if ifObj(o) then return o.SetPageLayout(class(TSXml).CurCodePageToUtf8(sheet), pageLayout); End; - ///获取工作表页面设置 + ///获取工作表页面布局 ///sheet: string,工作表名称 ///返回: TPageLayout对象 Function GetPageLayout(sheet); @@ -799,6 +798,21 @@ Type TSExcelFile = Class return workbook_.CopySheet(class(TSXml).CurCodePageToUtf8(sourceSheet), class(TSXml).CurCodePageToUtf8(destSheet)); End; + ///保护工作表 + ///sheet: 工作表 + ///protect: TProtect对象 + Function ProtectSheet(sheet, protect); + Begin + return workbook_.ProtectSheet(class(TSXml).CurCodePageToUtf8(sheet), protect); + End; + + ///取消保护工作 + ///sheet: 工作表 + Function UnProtectSheet(sheet); + Begin + return workbook_.UnProtectSheet(class(TSXml).CurCodePageToUtf8(sheet)); + End; + Function WorkBook(); Begin return workbook_; diff --git a/funcext/TSOffice/TSUtils/NodeInfo.tsf b/funcext/TSOffice/TSUtils/NodeInfo.tsf index 5ef1089..ee036c3 100644 --- a/funcext/TSOffice/TSUtils/NodeInfo.tsf +++ b/funcext/TSOffice/TSUtils/NodeInfo.tsf @@ -3,7 +3,10 @@ Type NodeInfo = class public Function Create(p, name); Begin - Parent := p; + if ifObj(p) then + NodeUri := p.NodeUri = '' ? name : (p.NodeUri + '/' + name); + else + NodeUri := ''; NodeName := name; ExtAttr := array(); ExtNodes := array(); @@ -20,7 +23,9 @@ public if ifObj(RootObj) then Begin arr := Marshal(); if length(arr['attributes']) or length(arr['children']) then Begin - class(TSXml).UpdateNode(RootObj, arr['attributes'], arr['children']); + curNode := class(TSXml).GetNode(RootObj, NodeUri); + if ifObj(curNode) then + class(TSXml).UpdateNode(curNode, arr['attributes'], arr['children']); End; End; End; @@ -152,32 +157,24 @@ public Function Value(name); Begin - uri := ifObj(Parent) ? NodeName : ''; - p := Parent; - rootNode := Root(); - while ifObj(p) do Begin - if ifObj(p.Parent) then - uri := p.NodeName + (uri ? '/' : '') + uri; - rootNode := p.Root(); - p := p.Parent; - End; - if not ifObj(rootNode) then return nil; + if not ifObj(RootObj) then return nil; + if NodeUri <> '' then + node := class(TSXml).GetNode(RootObj, NodeUri); + else + node := RootObj; + if not ifObj(node) then return nil; attrs := GetAttrsEx(); lName := lowerCase(name); r := sselect * from attrs where lName = lowerCase([0]) end; - if istable(r) then Begin - node := class(TSXml).GetNode(rootNode, uri); - if not ifObj(node) then return nil; + if istable(r) then return node.GetAttribute(r[1]); - End; children := GetChildren(); r := select * from children where lName = lowerCase(['field']) end; if istable(r) then Begin r := r[0]; - uri := (uri='' ? '' : uri + '/') + r['name']; - node := class(TSXml).GetNode(rootNode, uri); + node := node.FirstChildElement(r['name']); if not ifObj(node) then return nil; if r['nodeType'] = 'empty' then return true; @@ -275,8 +272,9 @@ public NodeName; ExtAttr; ExtNodes; - Parent; + //Parent; ReplaceArr; RootObj; + NodeUri:string; children_; End diff --git a/funcext/TSOffice/TSUtils/TOfficeApi.tsf b/funcext/TSOffice/TSUtils/TOfficeApi.tsf index 7ee511c..048ca70 100644 --- a/funcext/TSOffice/TSUtils/TOfficeApi.tsf +++ b/funcext/TSOffice/TSUtils/TOfficeApi.tsf @@ -158,6 +158,22 @@ Type TOffice = Class return getChartImpl(p, true); End; + ///获取当前TSL代码段上一个文本框图 + ///[p]:可选参数,为Nil指当前段落 + ///返回:TTextBox对象 + Function GetPrevTextBox(p); + Begin + p1 := getTextBoxImpl(p, false); + End; + + ///获取当前TSL代码段下一个文本框图 + ///[p]:可选参数,为Nil指当前段落 + ///返回:TTextBox对象 + Function GetNextTextBox(p); + Begin + return getTextBoxImpl(p, true); + End; + Function Set(k, v); Begin hash_[k] := v; @@ -214,5 +230,22 @@ private return nil; End; + Function getTextBoxImpl(p, next); + Begin + if not ifObj(p) then + p := GetCurrentParagraph(); + node := next ? p.node_.NextElement('w:p') : p.node_.PrevElement('w:p'); + while ifObj(node) do Begin + p := TOfficeObj('TParagraph'); + boxs := p.TextBoxs(); + if istable(boxs) then Begin + if next then return boxs[0]; + return boxs[ length(boxs) - 1]; + End; + node := next ? p.node.NextElement('w:p') : p.node.PrevElement('w:p'); + End; + return nil; + End; + hash_; -End; \ No newline at end of file +End; diff --git a/funcext/TSOffice/TSUtils/TSXml.tsf b/funcext/TSOffice/TSUtils/TSXml.tsf index cca1965..280d196 100644 --- a/funcext/TSOffice/TSUtils/TSXml.tsf +++ b/funcext/TSOffice/TSUtils/TSXml.tsf @@ -261,7 +261,7 @@ Type TSXml = Class class Function GetWorkSheetPrevNode(workNode, nodeName); Begin - order_arr := array('dimension', 'sheetViews', 'sheetFormatPr', 'cols', 'sheetData', 'mergeCells', 'phoneticPr', + order_arr := array('dimension', 'sheetViews', 'sheetFormatPr', 'cols', 'sheetData', 'sheetProtection', 'mergeCells', 'phoneticPr', 'hyperlinks', 'pageMargins', 'headerFooter', 'pageSetup', 'rowBreaks', 'colBreaks', 'drawing', 'legacyDrawing', 'picture'); for i:=0 to length(order_arr)-1 do begin diff --git a/funcext/TSOffice/document/TDocxStyles.tsf b/funcext/TSOffice/document/TDocxStyles.tsf index a14099b..fd1862b 100644 --- a/funcext/TSOffice/document/TDocxStyles.tsf +++ b/funcext/TSOffice/document/TDocxStyles.tsf @@ -38,7 +38,7 @@ Type TDocxStyles = Class Function Default(styleType); Begin for k, obj in idMap_ do Begin - if obj.wType_ = styleType then Begin + if obj.wType = styleType then Begin v := obj.node_.GetAttribute('w:default'); if v <> '1' then return obj; diff --git a/funcext/TSOffice/worksheet/xlsxImage.tsf b/funcext/TSOffice/worksheet/xlsxImage.tsf index 51a21ac..a22542a 100644 --- a/funcext/TSOffice/worksheet/xlsxImage.tsf +++ b/funcext/TSOffice/worksheet/xlsxImage.tsf @@ -96,7 +96,6 @@ Type xlsxImage = Class o.Pic.NvPicPr.NodeName := 'xdr:nvPicPr'; o.Pic.NvPicPr.CNvPr.Name := picture.Name ? picture.Name : ''; o.Pic.NvPicPr.CNvPr.ID := class(TSXml).GetcNvPrID(drawing_xml); - o.Pic.NvPicPr.CNvPr.Descr := picture.Descr ? : ''; o.Pic.NvPicPr.CNvPr.ExtLst.Ext.Uri := ''; o.Pic.NvPicPr.CNvPr.ExtLst.Ext.Xmlns16 := 'http://schemas.microsoft.com/office/drawing/2014/main'; o.Pic.NvPicPr.CNvPr.Replace(array("pic:": "xdr:")); diff --git a/funcext/TSOffice/worksheet/xlsxShape.tsf b/funcext/TSOffice/worksheet/xlsxShape.tsf index 896a65d..c11a4d3 100644 --- a/funcext/TSOffice/worksheet/xlsxShape.tsf +++ b/funcext/TSOffice/worksheet/xlsxShape.tsf @@ -7,13 +7,6 @@ Type xlsxShape = Class zipfile_ := excel.Zip(); drawing_id := excel_.WorkBook().GetSheetDrawing(sheetName_); - sheet_xml := excel_.WorkBook().GetSheetXmlfile(sheetName_); - node := sheet_xml.FirstChildElement('worksheet'); - drawing_node := node.FirstChildElement('drawing'); - if not ifObj(drawing_node) then - drawing_node := node.InsertEndChild('element', 'drawing'); - drawing_node.SetAttribute('r:id', 'rId' $ drawing_id); - // drawingN.xml drawingXmlObj_ := excel_.WorkBook().GetXmlFileObj('xl/drawings/drawing' $ drawing_id $ ".xml"); End; diff --git a/funcext/TSOffice/worksheet/xlsxSheetView.tsf b/funcext/TSOffice/worksheet/xlsxSheetView.tsf index 58a20d5..0cd41ca 100644 --- a/funcext/TSOffice/worksheet/xlsxSheetView.tsf +++ b/funcext/TSOffice/worksheet/xlsxSheetView.tsf @@ -15,6 +15,11 @@ Type xlsxSheetView = Class id := sheet_view_node.GetAttribute('workbookViewId'); if trystrtoint(id, r) and r = viewIndex then Begin + attributes := sheet_view_node.Attributes(); + sheetView.TabSelected := attributes['tabselected']; + sheetView.WorkbookViewId := attributes['workbookViewId']; + sheetView.ZoomScaleNormal := ZoomScale; + for k, v in attributes do sheet_view_node.DeleteAttribute(k); marshal := SheetView.Marshal(); class(TSXml).UpdateNode(sheet_view_node, marshal['attributes'], array()); return ''; @@ -32,15 +37,13 @@ Type xlsxSheetView = Class id := sheet_view_node.GetAttribute('workbookViewId'); if trystrtoint(id, r) and r = viewIndex then Begin - marshal := sheet_view_node.Marshal()[0]; sheetview := TOfficeObj('TSheetView'); - sheetview.ShowGridLines := marshal['attributes']['showGridLines']; - sheetview.ShowRowColHeaders := marshal['attributes']['showRowColHeaders']; - sheetview.ZoomScale := marshal['attributes']['zoomScale']; - sheetview.ZoomScaleNormal := marshal['attributes']['zoomScaleNormal']; + sheetview.RootObj := sheet_view_node; return sheetview; End + sheet_view_node := sheet_view_node.NextElement(); End + return nil; End class Function NewObject(sheetname, file); diff --git a/funcext/TSOffice/worksheet/xlsxWorkBook.tsf b/funcext/TSOffice/worksheet/xlsxWorkBook.tsf index 77e75a2..300b579 100644 --- a/funcext/TSOffice/worksheet/xlsxWorkBook.tsf +++ b/funcext/TSOffice/worksheet/xlsxWorkBook.tsf @@ -902,6 +902,25 @@ Type xlsxWorkBook = Class end End + Function ProtectSheet(sheet, protect); + Begin + sheet_obj := GetSheetXmlfile(sheet); + work_node := sheet_obj.FirstChildElement('worksheet'); + sheet_protection_node := work_node.FirstChildElement('sheetProtection'); + if ifObj(sheet_protection_node) then work_node.DeleteChild(sheet_protection_node); + prev_node := class(TSXml).GetWorkSheetPrevNode(work_node, 'sheetProtection'); + protect.Sheet := 1; + work_node.InsertAfterChild(prev_node, protect.Marshal()); + End; + + Function UnProtectSheet(sheet); + Begin + sheet_obj := GetSheetXmlfile(sheet); + work_node := sheet_obj.FirstChildElement('worksheet'); + sheet_protection_node := work_node.FirstChildElement('sheetProtection'); + if ifObj(sheet_protection_node) then work_node.DeleteChild(sheet_protection_node); + End; + Function GetXmlFileObj(n); Begin o := xmlFileObjMap_[ n ]; diff --git a/更新日志.md b/更新日志.md index 29b7aed..54fb568 100644 --- a/更新日志.md +++ b/更新日志.md @@ -1,5 +1,21 @@ # 更新日志 +## 2023-1-18 + +### V1.1.1 + +#### word + +1. 兼容文本框`TextBox` +2. 修正`TParagraph::TabStops` +3. 修复获取图标列表失败问题 +4. 修复`TDocxStyles::Default` + +#### excel + +1. 新增`ProtectSheet`和`UnProtectSheet` +2. 修复`SetSheetViewOptions`和`GetSheetViewOptions` + ## 2023-1-16 ### V1.1.0