diff --git a/Demo/ExcelHelp.tsl b/Demo/ExcelHelp.tsl index f43688c..73b1f77 100644 --- a/Demo/ExcelHelp.tsl +++ b/Demo/ExcelHelp.tsl @@ -56,9 +56,11 @@ style.Border.Top.LineStyle := "double"; style.Border.Top.Color := "FF0000"; style.Alignment.Horizontal := "center"; style.Alignment.Vertical := "center"; -style.Fill.Gradient.Shading := 3; -style.Fill.Gradient.Color1 := "FFFFFF"; -style.Fill.Gradient.Color2 := "E0EBF5"; +style.Fill.Gradient.Degree := 0; +style.Fill.Gradient.Stop1.Position := 0; +style.Fill.Gradient.Stop1.Color := "FFFFFF"; +style.Fill.Gradient.Stop2.Position := 1; +style.Fill.Gradient.Stop2.Color := "E0EBF5"; styleId := file.NewStyle(style); PrintSuccess("NewStyle", testing++); @@ -223,9 +225,15 @@ Begin style.Font.Size := 14; style.Font.Bold := True; style.Font.UnderLine := 'singleAccounting'; - style.Fill.Gradient.Shading := 16; - style.Fill.Gradient.Color1 := 'A3ECFB'; - style.Fill.Gradient.Color2 := '626AD8'; + style.Fill.Gradient.Type := 'path'; + style.Fill.Gradient.Left := 0.5; + style.Fill.Gradient.Right := 0.5; + style.Fill.Gradient.Top := 0.5; + style.Fill.Gradient.Bottom := 0.5; + style.Fill.Gradient.Stop1.Position := 0; + style.Fill.Gradient.Stop1.Color := 'A3ECFB'; + style.Fill.Gradient.Stop2.Position := 1; + style.Fill.Gradient.Stop2.Color := '626AD8'; styleid1 := excel.NewStyle(style); style := TOfficeObj('TStyle'); @@ -487,9 +495,11 @@ style.NumberFormat.FormatCode := '#,##0.000_ '; //style.Fill.Pattern.PatternType := 'solid'; //style.Fill.Pattern.ForegroundColor := 'FF6699FF'; //style.Fill.Pattern.BackgroundColor := 'FFFF0000'; -style.Fill.Gradient.ThemeColor1 := 0; -style.Fill.Gradient.ThemeColor2 := 4; -style.Fill.Gradient.Shading := 1; +style.Fill.Gradient.Degree := 270; +style.Fill.Gradient.Stop1.Position := 0; +style.Fill.Gradient.Stop1.ThemeColor := 0; +style.Fill.Gradient.Stop2.Position := 1; +style.Fill.Gradient.Stop2.ThemeColor := 4; style.Protection.Hide := 1; style.Protection.Lock := 1; "; @@ -596,30 +606,26 @@ style.Protection.Lock := 1; ('ObjName': 'TGradient', 'Desc': ('TGradient有以下属性: '), 'AttrInfo': ( - ('attrName': '', 'type': '', 'desc': '{颜色1}:渐变的第一种颜色,{Color1}和{ThemeColor1}只能设置一种', 'value': array()), - ('attrName': 'Color1', 'type': 'string', 'desc': 'RGB颜色', 'value': array()), - ('attrName': 'ThemeColor1', 'type': 'int', 'desc': '主题颜色', 'value': array()), - ('attrName': '', 'type': '', 'desc': '{颜色2}:渐变的第一种颜色,{Color2}和{ThemeColor2}只能设置一种', 'value': array()), - ('attrName': 'Color2', 'type': 'string', 'desc': 'RGB颜色', 'value': array()), - ('attrName': 'ThemeColor2', 'type': 'int', 'desc': '主题颜色', 'value': array()), - ('attrName': 'Shading', 'type': 'int', 'desc': '底纹样式', 'value': array('0: 水平渐变,颜色1从上到下渐变到颜色2', '1: 水平渐变,颜色2从上到下渐变到颜色1', - '2: 水平渐变,三层颜色,颜色1从上渐变到中间颜色2,再从颜色2渐变到底部颜色1', - '3: 垂直渐变,颜色1从左到右渐变到颜色2', - '4: 垂直渐变,颜色2从右到左渐变到颜色1', - '5: 垂直渐变,三层颜色,颜色1从左渐变到中间颜色2,再从颜色2渐变到右边颜色1', - '6: 斜上渐变,颜色1左上渐变到右下颜色2', - '7: 斜上渐变,颜色2左上渐变到右下颜色1', - '8: 斜上渐变,三层颜色,颜色1从左上渐变到对角线颜色2,再从颜色2渐变到右下颜色1', - '9: 斜下渐变,颜色1右上渐变到左下颜色2', - '10: 斜下渐变,颜色2左上渐变到右下颜色1', - '11: 斜下渐变,三层颜色,颜色1从左上渐变到对角线颜色2,再从颜色2渐变到右下颜色1', - '12: 角部辐射渐变,颜色1左上角辐射渐变到右下角2', - '13: 角部辐射渐变,颜色1右上角辐射渐变到左下角颜色2', - '14: 角部辐射渐变,颜色1左下角辐射渐变到右上角2', - '15: 角部辐射渐变,颜色1右下角辐射渐变到左上角颜色2', - '16: 中心辐射渐变,颜色1从中心向四周辐射到颜色2', - )), - ), + ('attrName': 'Degree', 'type': 'int', 'desc': '渐变的角度(水平、垂直、斜上、斜下)', 'value': array(0, 45, 90, 135, 180, 225, 270, 315)), + ('attrName': 'Type', 'type': 'string', 'desc': '辐射渐变,采用辐射渐变时,不需设置{Degree}', 'value': array('path')), + ('attrName': 'Left', 'type': 'string', 'desc': '辐射渐变时需设置属性', 'value': array()), + ('attrName': 'Right', 'type': 'string', 'desc': '辐射渐变时需设置属性', 'value': array()), + ('attrName': 'Top', 'type': 'string', 'desc': '辐射渐变时需设置属性', 'value': array()), + ('attrName': 'Bottom', 'type': 'string', 'desc': '辐射渐变时需设置属性', 'value': array()), + ('attrName': 'Stop1', 'type': 'class - TStop', 'desc': '渐变点需要设置的信息', 'value': array()), + ('attrName': 'Stop2', 'type': 'class - TStop', 'desc': '渐变点需要设置的信息', 'value': array()), + ('attrName': 'Stop3', 'type': 'class - TStop', 'desc': '渐变点需要设置的信息', 'value': array()), + ), + 'Demo': '', + ), + ('ObjName': 'TStop', + 'Desc': ('TStop有以下属性: '), + 'AttrInfo': ( + ('attrName': 'Position', 'type': 'double', 'desc': '', 'value': array()), + ('attrName': 'Color', 'type': 'string', 'desc': 'RGB颜色', 'value': array()), + ('attrName': 'ThemeColor', 'type': 'int', 'desc': '主题颜色', 'value': array()), + ('attrName': 'ThemeColorTint', 'type': 'int', 'desc': '主题颜色的色调', 'value': array()), + ), 'Demo': '', ), ('ObjName': 'TProtection', diff --git a/Demo/excel_demo.tsl b/Demo/excel_demo.tsl index e03bb94..0e890b0 100644 --- a/Demo/excel_demo.tsl +++ b/Demo/excel_demo.tsl @@ -1,8 +1,8 @@ -TOfficeApi().CodePage('中文'); +TOfficeApi().CodePage(''); testCount := 0; -sheetName := "你好"; -sheetName2 := "中文"; +sheetName := ""; +sheetName2 := ""; // OpenFile excel := new TSExcelFile(); @@ -43,6 +43,14 @@ println("[success] GetSheetName = {}", Name); excel.NewSheet(sheetName2); println("[success] NewSheet"); +// NewSheet +excel.NewSheet(sheetName, 'sheet_copy'); +println("[success] NewSheet2"); + +// InsertSheet +excel.InsertSheet(sheetName, sheetName + 'before'); +println("[success] NewSheet2"); + // GetSheets sheets := excel.GetSheets(); println("[success] sheets = {}", sheets); @@ -54,7 +62,7 @@ println("[success] DeleteSheet"); // SetCellValue excel.SetCellValue(sheetName, "A1", 100); -excel.SetCellValue(sheetName, "F1", "中文的壹佰"); +excel.SetCellValue(sheetName, "F1", "ĵҼ"); println("[success] SetCellValue"); // GetCellValue @@ -63,6 +71,10 @@ PrintInfo("GetCellValue A1 ", err, errmsg); [err, errmsg] := excel.GetCellValue(sheetName, "F1"); PrintInfo("GetCellValue F1 ", err, errmsg); +// GetCellValue +[err, errmsg] := excel.GetCellRawValue(sheetName, "A1"); +PrintInfo("GetCellRawValue A1 ", err, errmsg); + // TotalCols totalCols := excel.TotalCols(sheetName); println("[success] TotalCols = {}", totalCols); @@ -73,7 +85,7 @@ println("[success] TotalRows = {}", totalRows); // SetCellRichText richText := TOfficeObj('TRichtext'); -text1 := richText.AddText('Hello 你好'); +text1 := richText.AddText('Hello '); text1.Font.Size := 35; text1.Font.Color := "FFF000"; text2 := richText.AddText(" World"); @@ -93,7 +105,7 @@ excel.ClearCell(sheetName, "A1"); println("[success] ClearCell"); // SetCellFormula -excel.SetCellFormula(sheetName, "A2", "=100*50"); +excel.SetCellFormula(sheetName, "A2", "100*50"); println("[success] SetCellFormula"); // GetCellFormula @@ -105,7 +117,7 @@ excel.SetSheetRow(sheetName, "C3", array(1, 2, 3, 4, "a", "b")); println("[success] SetSheetRow"); // InsertTable -table := array((1, 2, "你好"), (4, 5, "b")); +table := array((1, 2, ""), (4, 5, "b")); //table2 := array(("title1" :1, "title2": 2), ("title1": 3, "title2": 4)); [err, errmsg] := excel.InsertTable(sheetName, "A5", table); PrintInfo("InsertTable", err, errmsg); @@ -219,6 +231,12 @@ PrintInfo("ColumnNumberToName", err, errmsg); [err, col, row] := excel.CellNameToCoordinates("A2"); if not err then println("[success] {} = col : {}, row = {}", "CellNameToCoordinates", col, row); +// CoordinatesToCellName +[err, cell] := excel.CoordinatesToCellName(1, 2, true); +println("[success] CoordinatesToCellName, cell = {}", cell); +[err, cell] := excel.CoordinatesToCellName(1, 2); +println("[success] CoordinatesToCellName, cell = {}", cell); + // RGBToHSL [h, s, l] := excel.RGBToHSL(255, 15, 33); println("[success] {} = {}, {}, {}", "RGBToHSL", h, s, l); @@ -231,7 +249,7 @@ println("[success] {} = {}, {}, {}", "HSLToRGB", r, g, b); style := TOfficeObj('TStyle'); style.Font.Color := "A020F0"; style.Font.Size := 22; -style.Font.Name := "黑体"; +style.Font.Name := ""; style.Font.Bold := True; style.Font.Charset := "134"; style.Font.Script := "subscript"; @@ -259,9 +277,11 @@ style.NumberFormat.FormatCode := "#,##0.000_ "; //style.Fill.Pattern.PatternType := "solid"; //style.Fill.Pattern.ForegroundColor := "FF6699FF"; //style.Fill.Pattern.BackgroundColor := "FFFF0000"; -style.Fill.Gradient.ThemeColor1 := 0; -style.Fill.Gradient.ThemeColor2 := 4; -style.Fill.Gradient.Shading := 1; +style.Fill.Gradient.Degree := 270; +style.Fill.Gradient.Stop1.Position := 0; +style.Fill.Gradient.Stop1.ThemeColor := 0; +style.Fill.Gradient.Stop2.Position := 1; +style.Fill.Gradient.Stop2.ThemeColor := 4; style.Protection.Hide := 1; style.Protection.Lock := 1; @@ -277,6 +297,31 @@ println("[success] GetCellStyle = {}", styleid); styleid := excel.GetCellStyle(sheetName, "D4"); println("[success] GetCellStyle = {}", styleid); +style := excel.GetStyle(styleid); +println("font.Name = {}", style.Font.Name); +println("font.Italic = {}", style.Font.Italic); +println("border.left.Color = {}", style.border.left.Color); +println("border.Top.LineStyle = {}", style.border.Top.LineStyle); +println("border.DiagonalDown = {}", style.border.DiagonalDown); +println("numberFormat.FormatCode = {}", style.NumberFormat.FormatCode); +println("alignment.vertical = {}", style.Alignment.Vertical); +println("alignment.TextRotation = {}", style.Alignment.TextRotation); +println("protection.Hide = {}", style.Protection.Hide); +println("protection.Lock = {}", style.Protection.Lock); +//println("fill.pattern.PatternType = {}", style.Fill.Pattern.PatternType); +//println("fill.pattern.ForegroundColor = {}", style.Fill.Pattern.ForegroundColor); +println("style.Fill.Gradient.Degree = {}", style.Fill.Gradient.Degree); +println("style.Fill.Gradient.Stop1.ThemeColor = {}", style.Fill.Gradient.Stop1.ThemeColor); +println("style.Fill.Gradient.Stop2.Position = {}", style.Fill.Gradient.Stop2.Position); + +style.Protection.Hide := 0; +style.Protection.Lock := 0; +style.Apply(); +style := excel.GetStyle(styleid); + +println("protection.Hide = {}", style.Protection.Hide); +println("protection.Lock = {}", style.Protection.Lock); + // SetSheetHeaderFooter headerFooter := TOfficeObj("THeaderFooter"); headerFooter.DifferentOddEven := true; @@ -332,8 +377,8 @@ println("[success] SetPageMargins"); // GetPageMargins margins := excel.GetPageMargins(sheetName2); println("[success] GetPageMargins top = {}, bottom = {}, left = {}, right = {}, header = {}, footer = {}", - margins.Value('Top'), margins.Value('Bottom'), margins.Value('Left'), margins.Value('Right'), - margins.Value('Header'), margins.Value('Footer')); + margins.Top, margins.Bottom, margins.Left, margins.Right, + margins.Header, margins.Footer); // MergeCell excel.SetCellStyle(sheetName2, "A4", "A4", styleid1); @@ -372,6 +417,7 @@ println("[success] SetPane"); pageLayout := TOfficeObj('TPageLayout'); pageLayout.FitToWidth := 10; pageLayout.FitToHeight := 10; +pageLayout.UseFirstPageNumber := true; pageLayout.FirstPageNumber := 5; pageLayout.Orientation := "portrait"; pageLayout.BlackAndWhite := true; @@ -402,8 +448,8 @@ excel.SetCellHyperLink(sheetName2, 'A1', link); link := TOfficeObj('THyperLink'); link.LinkType := "external"; link.LinkUrl := "https://www.baidu.com"; -link.Tooltip := "超链接悬浮提示"; -excel.SetCellValue(sheetName2, 'A2', '超链接'); +link.Tooltip := "ʾ"; +excel.SetCellValue(sheetName2, 'A2', ''); excel.SetCellHyperLink(sheetName2, 'A2', link); println("[success] SetCellHyperLink"); @@ -431,12 +477,12 @@ println("[success] AddPicture"); excel.DeletePicture(sheetName2, 'A1', 'D17'); println("[success] DeletePicture"); -// TODO 可能有问题 +// TODO // AddTable table2 := array(("title1" :1, "title2": 2), ("title1": 3, "title2": 4)); excel.InsertTable(sheetName2, "A9", table2, true); tablestyle := TOfficeObj('TTableStyle'); -tablestyle.TableName := "测试表"; +tablestyle.TableName := "Ա"; tablestyle.TableStyle := "TableStyleMedium2"; tablestyle.ShowFirstColumn := True; tablestyle.ShowLastColumn := True; @@ -466,9 +512,9 @@ println("[success] AddShape"); // SetCoreProps core := TOfficeObj('TCoreProperty'); -core.Title := "标题"; -core.Subject := "主题"; -core.Creator := "作者"; +core.Title := ""; +core.Subject := ""; +core.Creator := ""; excel.SetCoreProps(core); // GetCoreProps @@ -484,8 +530,8 @@ appProps.Company := "TS"; appProps.LinksUpToDate := "true"; appProps.HyperlinksChanged := "true"; appProps.Version := "1.000"; -appProps.Manager := "这是主管"; -//appProps.HyperlinkBase := "这是超链接基础"; +appProps.Manager := ""; +//appProps.HyperlinkBase := "dzӻ"; excel.SetAppProps(appProps); println("[success] SetAppProps"); @@ -519,7 +565,7 @@ println("[success] ProtectSheet"); // SetDefaultFont font := tofficeobj('tfont'); -font.Name := '黑体'; +font.Name := ''; font.Size := 13; font.ThemeColor := 1; excel.SetDefaultFont(font); @@ -528,6 +574,44 @@ println("[success] SetDefaultFont"); tfont := excel.GetDefaultFont(); println("[success] GetDefaultFont , name = {}, size = {}, themecolor = {}", tfont.Name, tfont.Size, tfont.ThemeColor); +calcpr := TOfficeObj('TCalcPr'); +calcpr.CalcMode := ""; +calcpr.RefMode := "R1C1"; +calcpr.Iterate := 1; +calcpr.IterateCount := 300; +calcpr.IterateDelta := "3E-3"; +calcpr.CalcOnSave := true; +calcpr.ConCurrentCalc := true; +calcpr.ConCurrentManualCount := 4; +calcpr.FullPrecision := 0; +excel.SetCalcOptions(calcpr); +println("[success] SetCalcOptions"); + +calc := excel.GetCalcOptions(); +println("[success] GetCalcOptions, CalcMode = {}, RefMode = {}, Iterate = {}, + IterateCount = {}, IterateDelta = {}, CalcOnSave = {}, conCurrentCalc = {}, + conCurrentManualCount = {}, FullPrecision = {}", calc.CalcMode, calc.RefMode, calc.Iterate, + calc.IterateCount, calc.IterateDelta, calc.CalcOnSave, calc.conCurrentCalc, + calc.conCurrentManualCount, calc.FullPrecision); + +excel.SetRowOutlineLevel(sheetName2, 1, 1); +excel.SetRowOutlineLevel(sheetName2, 2, 1); +println("[success] SetRowOutlineLevel"); + +level1 := excel.GetRowOutlineLevel(sheetName2, 1); +level2 := excel.GetRowOutlineLevel(sheetName2, 3); + +println("[success] GetRowOutlineLevel, level1 = {}, level2 = {}", level1, level2); + +excel.SetColOutlineLevel(sheetName2, 'A', 1); +excel.SetColOutlineLevel(sheetName2, 'B', 2); +excel.SetColOutlineLevel(sheetName2, 'C', 1); +println("[success] SetColOutlineLevel"); + +level1 := excel.GetColOutlineLevel(sheetName2, 'A'); +level2 := excel.GetColOutlineLevel(sheetName2, 'B'); +println("[success] GetColOutlineLevel, level1 = {}, level2 = {}", level1, level2); + [err, errmsg] := excel.saveas("", "d:\\temp\\test.xlsx"); println("saveas : {}", err); diff --git a/ExcelFile使用帮助.xlsx b/ExcelFile使用帮助.xlsx index 981fbfd..7e32df4 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 88da7a9..e70cb5b 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 45b7850..0f71d7d 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 1150a7c..1ad8a2b 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 1d9981c..91697ed 100644 --- a/funcext/TSOffice/TOfficeObj.tsf +++ b/funcext/TSOffice/TOfficeObj.tsf @@ -1,4 +1,4 @@ -// Version 1.2.1 +// Version 1.2.2 Function TOfficeObj(n); Begin @@ -121,10 +121,10 @@ Begin return new TBorders(); "tnumfmts": return new TNumFmts(); - "tfills": - return new TFills(); "tgradient": return new TGradient(); + "tfills": + return new TFills(); "tpattern": return new TPattern(); "tstop": @@ -3560,31 +3560,83 @@ type TBorder=class(NodeInfo) RootObj := node; End; + Property Color read readXMLColor write writeXMLColor; + Function readXMLColor(); + Begin + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('Color')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLColor); + End; + + Function writeXMLColor(str); + Begin + XMLColor := class(TSXml).CurCodePageToUtf8(str); + End; + + Property ThemeColor read readXMLThemeColor write writeXMLThemeColor; + Function readXMLThemeColor(); + Begin + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('ThemeColor')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLThemeColor); + End; + + Function writeXMLThemeColor(str); + Begin + XMLThemeColor := class(TSXml).CurCodePageToUtf8(str); + End; + + Property ThemeColorTint read readXMLThemeColorTint write writeXMLThemeColorTint; + Function readXMLThemeColorTint(); + Begin + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('ThemeColorTint')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLThemeColorTint); + End; + + Function writeXMLThemeColorTint(str); + Begin + XMLThemeColorTint := class(TSXml).CurCodePageToUtf8(str); + End; + + Property LineStyle read readXMLLineStyle write writeXMLLineStyle; + Function readXMLLineStyle(); + Begin + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('LineStyle')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLLineStyle); + End; + + Function writeXMLLineStyle(str); + Begin + XMLLineStyle := class(TSXml).CurCodePageToUtf8(str); + End; + Function GetAttrs(); override; Begin HandleAttrs(); - return array(("LineStyle", "style", LineStyle, "")) union ExtAttr; + return array(("LineStyle", "style", XMLLineStyle, "")) union ExtAttr; End; Function GetChildren(); override; Begin HandleChildren(); - return array(("field":"Color","name":"color","obj":Color,"attrEx":"rgb","nodeType":"","attrName":"", "desc":"", "class":"") - ,("field":"ColorIndex","name":"ColorIndex","obj":ColorIndex,"attrEx":"","nodeType":"","attrName":"", "desc":"", "class":"") + return array(("field":"Color","name":"color","obj":XMLColor,"attrEx":"rgb","nodeType":"","attrName":"", "desc":"", "class":"") + ,("field":"ThemeColor","name":"color","obj":XMLThemeColor,"attrEx":"theme","nodeType":"","attrName":"", "desc":"", "class":"") + ,("field":"ThemeColorTint","name":"color","obj":XMLThemeColorTint,"attrEx":"tint","nodeType":"","attrName":"", "desc":"", "class":"") ,("field":"Weight","name":"weight","obj":Weight,"attrEx":"","nodeType":"","attrName":"", "desc":"", "class":"") - ,("field":"ThemeColor","name":"color","obj":ThemeColor,"attrEx":"theme","nodeType":"","attrName":"", "desc":"", "class":"") ,("field":"TintAndShade","name":"tintandshade","obj":TintAndShade,"attrEx":"","nodeType":"","attrName":"", "desc":"", "class":"") ) union ExtNodes; End; //Attributes - LineStyle; + XMLLineStyle; //Nodes - Color; - ColorIndex; + XMLColor; + XMLThemeColor; + XMLThemeColorTint; Weight; - ThemeColor; TintAndShade; End; @@ -3623,6 +3675,32 @@ type TBorders=class(NodeInfo) Diagonal.InitRootNode(node); End; + Property DiagonalDown read readXMLDiagonalDown write writeXMLDiagonalDown; + Function readXMLDiagonalDown(); + Begin + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('DiagonalDown')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLDiagonalDown); + End; + + Function writeXMLDiagonalDown(str); + Begin + XMLDiagonalDown := class(TSXml).CurCodePageToUtf8(str); + End; + + Property DiagonalUp read readXMLDiagonalUp write writeXMLDiagonalUp; + Function readXMLDiagonalUp(); + Begin + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('DiagonalUp')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLDiagonalUp); + End; + + Function writeXMLDiagonalUp(str); + Begin + XMLDiagonalUp := class(TSXml).CurCodePageToUtf8(str); + End; + Function GetAttrs(); override; Begin HandleAttrs(); @@ -3637,8 +3715,8 @@ type TBorders=class(NodeInfo) ,("field":"Top","name":Top.NodeName,"obj":Top,"attrEx":"","nodeType":"","attrName":"", "desc":"", "class":"TBorder") ,("field":"Bottom","name":Bottom.NodeName,"obj":Bottom,"attrEx":"","nodeType":"","attrName":"", "desc":"", "class":"TBorder") ,("field":"Diagonal","name":Diagonal.NodeName,"obj":Diagonal,"attrEx":"","nodeType":"","attrName":"", "desc":"", "class":"TBorder") - ,("field":"DiagonalDown","name":"diagonalDown","obj":DiagonalDown,"attrEx":"","nodeType":"","attrName":"", "desc":"", "class":"") - ,("field":"DiagonalUp","name":"diagonalUp","obj":DiagonalUp,"attrEx":"","nodeType":"","attrName":"", "desc":"", "class":"") + ,("field":"DiagonalDown","name":"diagonalDown","obj":XMLDiagonalDown,"attrEx":"","nodeType":"","attrName":"", "desc":"", "class":"") + ,("field":"DiagonalUp","name":"diagonalUp","obj":XMLDiagonalUp,"attrEx":"","nodeType":"","attrName":"", "desc":"", "class":"") ) union ExtNodes; End; @@ -3650,8 +3728,8 @@ type TBorders=class(NodeInfo) Top; Bottom; Diagonal; - DiagonalDown; - DiagonalUp; + XMLDiagonalDown; + XMLDiagonalUp; End; /////////////////////////////////////////////////////////////// @@ -3679,10 +3757,36 @@ type TNumFmts=class(NodeInfo) RootObj := node; End; + Property NumFmtId read readXMLNumFmtId write writeXMLNumFmtId; + Function readXMLNumFmtId(); + Begin + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('NumFmtId')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLNumFmtId); + End; + + Function writeXMLNumFmtId(str); + Begin + XMLNumFmtId := class(TSXml).CurCodePageToUtf8(str); + End; + + Property FormatCode read readXMLFormatCode write writeXMLFormatCode; + Function readXMLFormatCode(); + Begin + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('FormatCode')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLFormatCode); + End; + + Function writeXMLFormatCode(str); + Begin + XMLFormatCode := class(TSXml).CurCodePageToUtf8(str); + End; + Function GetAttrs(); override; Begin HandleAttrs(); - return array(("NumFmtId", "numFmtId", NumFmtId, ""),("FormatCode", "formatCode", FormatCode, "")) union ExtAttr; + return array(("NumFmtId", "numFmtId", XMLNumFmtId, ""),("FormatCode", "formatCode", XMLFormatCode, "")) union ExtAttr; End; Function GetChildren(); override; @@ -3692,12 +3796,150 @@ type TNumFmts=class(NodeInfo) End; //Attributes - NumFmtId; - FormatCode; + XMLNumFmtId; + XMLFormatCode; //Nodes End; +/////////////////////////////////////////////////////////////// +/// TGradient +/////////////////////////////////////////////////////////////// +type TGradient=class(NodeInfo) + Function Create(); overload; + Begin + Create(nil, 'gradientFill'); + End; + + Function Create(p, name); overload; + Begin + Class(NodeInfo).Create(p, name); + Init(); + End; + + Function Init(); + Begin + Stop1 := new TStop(self, 'stop'); + Stop2 := new TStop(self, 'stop'); + Stop3 := new TStop(self, 'stop'); + //TODO... + End; + + Function InitRootNode(node); + Begin + RootObj := node; + Stop1.InitRootNode(node); + Stop2.InitRootNode(node); + Stop3.InitRootNode(node); + End; + + Property Degree read readXMLDegree write writeXMLDegree; + Function readXMLDegree(); + Begin + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('Degree')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLDegree); + End; + + Function writeXMLDegree(str); + Begin + XMLDegree := class(TSXml).CurCodePageToUtf8(str); + End; + + Property Type read readXMLType write writeXMLType; + Function readXMLType(); + Begin + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('Type')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLType); + End; + + Function writeXMLType(str); + Begin + XMLType := class(TSXml).CurCodePageToUtf8(str); + End; + + Property Left read readXMLLeft write writeXMLLeft; + Function readXMLLeft(); + Begin + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('Left')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLLeft); + End; + + Function writeXMLLeft(str); + Begin + XMLLeft := class(TSXml).CurCodePageToUtf8(str); + End; + + Property Right read readXMLRight write writeXMLRight; + Function readXMLRight(); + Begin + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('Right')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLRight); + End; + + Function writeXMLRight(str); + Begin + XMLRight := class(TSXml).CurCodePageToUtf8(str); + End; + + Property Top read readXMLTop write writeXMLTop; + Function readXMLTop(); + Begin + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('Top')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLTop); + End; + + Function writeXMLTop(str); + Begin + XMLTop := class(TSXml).CurCodePageToUtf8(str); + End; + + Property Bottom read readXMLBottom write writeXMLBottom; + Function readXMLBottom(); + Begin + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('Bottom')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLBottom); + End; + + Function writeXMLBottom(str); + Begin + XMLBottom := class(TSXml).CurCodePageToUtf8(str); + End; + + Function GetAttrs(); override; + Begin + HandleAttrs(); + return array(("Degree", "degree", XMLDegree, ""),("Type", "type", XMLType, ""),("Left", "left", XMLLeft, ""),("Right", "right", XMLRight, ""),("Top", "top", XMLTop, ""),("Bottom", "bottom", XMLBottom, "")) union ExtAttr; + End; + + Function GetChildren(); override; + Begin + HandleChildren(); + return array(("field":"Stop1","name":Stop1.NodeName,"obj":Stop1,"attrEx":"","nodeType":"","attrName":"", "desc":"", "class":"TStop") + ,("field":"Stop2","name":Stop2.NodeName,"obj":Stop2,"attrEx":"","nodeType":"","attrName":"", "desc":"", "class":"TStop") + ,("field":"Stop3","name":Stop3.NodeName,"obj":Stop3,"attrEx":"","nodeType":"","attrName":"", "desc":"", "class":"TStop") + ) union ExtNodes; + End; + + //Attributes + XMLDegree; + XMLType; + XMLLeft; + XMLRight; + XMLTop; + XMLBottom; + + //Nodes + Stop1; + Stop2; + Stop3; +End; + /////////////////////////////////////////////////////////////// /// TFills /////////////////////////////////////////////////////////////// @@ -3748,53 +3990,6 @@ type TFills=class(NodeInfo) Gradient; End; -/////////////////////////////////////////////////////////////// -/// TGradientImpl -/////////////////////////////////////////////////////////////// -type TGradientImpl=class(NodeInfo) - Function Create(); overload; - Begin - Create(nil, 'gradientFill'); - 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(("Shading", "Shading", Shading, ""),("Color1", "color", Color1, ""),("ThemeColor1", "color", ThemeColor1, ""),("Color2", "color", Color2, ""),("ThemeColor2", "color", ThemeColor2, "")) union ExtAttr; - End; - - Function GetChildren(); override; - Begin - HandleChildren(); - return ExtNodes; - End; - - //Attributes - Shading; - Color1; - ThemeColor1; - Color2; - ThemeColor2; - - //Nodes -End; - /////////////////////////////////////////////////////////////// /// TPattern /////////////////////////////////////////////////////////////// @@ -3820,34 +4015,125 @@ type TPattern=class(NodeInfo) RootObj := node; End; + Property PatternType read readXMLPatternType write writeXMLPatternType; + Function readXMLPatternType(); + Begin + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('PatternType')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLPatternType); + End; + + Function writeXMLPatternType(str); + Begin + XMLPatternType := class(TSXml).CurCodePageToUtf8(str); + End; + + Property ForegroundColor read readXMLForegroundColor write writeXMLForegroundColor; + Function readXMLForegroundColor(); + Begin + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('ForegroundColor')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLForegroundColor); + End; + + Function writeXMLForegroundColor(str); + Begin + XMLForegroundColor := class(TSXml).CurCodePageToUtf8(str); + End; + + Property BackgroundColor read readXMLBackgroundColor write writeXMLBackgroundColor; + Function readXMLBackgroundColor(); + Begin + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('BackgroundColor')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLBackgroundColor); + End; + + Function writeXMLBackgroundColor(str); + Begin + XMLBackgroundColor := class(TSXml).CurCodePageToUtf8(str); + End; + + Property ForegroundThemeColor read readXMLForegroundThemeColor write writeXMLForegroundThemeColor; + Function readXMLForegroundThemeColor(); + Begin + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('ForegroundThemeColor')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLForegroundThemeColor); + End; + + Function writeXMLForegroundThemeColor(str); + Begin + XMLForegroundThemeColor := class(TSXml).CurCodePageToUtf8(str); + End; + + Property BackgroundThemeColor read readXMLBackgroundThemeColor write writeXMLBackgroundThemeColor; + Function readXMLBackgroundThemeColor(); + Begin + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('BackgroundThemeColor')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLBackgroundThemeColor); + End; + + Function writeXMLBackgroundThemeColor(str); + Begin + XMLBackgroundThemeColor := class(TSXml).CurCodePageToUtf8(str); + End; + + Property ForegroundThemeColorTint read readXMLForegroundThemeColorTint write writeXMLForegroundThemeColorTint; + Function readXMLForegroundThemeColorTint(); + Begin + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('ForegroundThemeColorTint')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLForegroundThemeColorTint); + End; + + Function writeXMLForegroundThemeColorTint(str); + Begin + XMLForegroundThemeColorTint := class(TSXml).CurCodePageToUtf8(str); + End; + + Property BackgroundThemeColorTint read readXMLBackgroundThemeColorTint write writeXMLBackgroundThemeColorTint; + Function readXMLBackgroundThemeColorTint(); + Begin + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('BackgroundThemeColorTint')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLBackgroundThemeColorTint); + End; + + Function writeXMLBackgroundThemeColorTint(str); + Begin + XMLBackgroundThemeColorTint := class(TSXml).CurCodePageToUtf8(str); + End; + Function GetAttrs(); override; Begin HandleAttrs(); - return array(("PatternType", "patternType", PatternType, "")) union ExtAttr; + return array(("PatternType", "patternType", XMLPatternType, "")) union ExtAttr; End; Function GetChildren(); override; Begin HandleChildren(); - return array(("field":"ForegroundColor","name":"fgColor","obj":ForegroundColor,"attrEx":"rgb","nodeType":"","attrName":"", "desc":"", "class":"") - ,("field":"BackgroundColor","name":"bgColor","obj":BackgroundColor,"attrEx":"rgb","nodeType":"","attrName":"", "desc":"", "class":"") - ,("field":"ForegroundThemeColor","name":"fgColor","obj":ForegroundThemeColor,"attrEx":"theme","nodeType":"","attrName":"", "desc":"", "class":"") - ,("field":"BackgroundThemeColor","name":"bgColor","obj":BackgroundThemeColor,"attrEx":"theme","nodeType":"","attrName":"", "desc":"", "class":"") - ,("field":"ForegroundThemeColorTint","name":"fgColor","obj":ForegroundThemeColorTint,"attrEx":"tint","nodeType":"","attrName":"", "desc":"", "class":"") - ,("field":"BackgroundThemeColorTint","name":"bgColor","obj":BackgroundThemeColorTint,"attrEx":"tint","nodeType":"","attrName":"", "desc":"", "class":"") + return array(("field":"ForegroundColor","name":"fgColor","obj":XMLForegroundColor,"attrEx":"rgb","nodeType":"","attrName":"", "desc":"", "class":"") + ,("field":"BackgroundColor","name":"bgColor","obj":XMLBackgroundColor,"attrEx":"rgb","nodeType":"","attrName":"", "desc":"", "class":"") + ,("field":"ForegroundThemeColor","name":"fgColor","obj":XMLForegroundThemeColor,"attrEx":"theme","nodeType":"","attrName":"", "desc":"", "class":"") + ,("field":"BackgroundThemeColor","name":"bgColor","obj":XMLBackgroundThemeColor,"attrEx":"theme","nodeType":"","attrName":"", "desc":"", "class":"") + ,("field":"ForegroundThemeColorTint","name":"fgColor","obj":XMLForegroundThemeColorTint,"attrEx":"tint","nodeType":"","attrName":"", "desc":"", "class":"") + ,("field":"BackgroundThemeColorTint","name":"bgColor","obj":XMLBackgroundThemeColorTint,"attrEx":"tint","nodeType":"","attrName":"", "desc":"", "class":"") ) union ExtNodes; End; //Attributes - PatternType; + XMLPatternType; //Nodes - ForegroundColor; - BackgroundColor; - ForegroundThemeColor; - BackgroundThemeColor; - ForegroundThemeColorTint; - BackgroundThemeColorTint; + XMLForegroundColor; + XMLBackgroundColor; + XMLForegroundThemeColor; + XMLBackgroundThemeColor; + XMLForegroundThemeColorTint; + XMLBackgroundThemeColorTint; End; /////////////////////////////////////////////////////////////// @@ -3875,28 +4161,95 @@ type TStop=class(NodeInfo) RootObj := node; End; + Property Position read readXMLPosition write writeXMLPosition; + Function readXMLPosition(); + Begin + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('Position')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLPosition); + End; + + Function writeXMLPosition(str); + Begin + XMLPosition := class(TSXml).CurCodePageToUtf8(str); + End; + + Property Color read readXMLColor write writeXMLColor; + Function readXMLColor(); + Begin + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('Color')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLColor); + End; + + Function writeXMLColor(str); + Begin + XMLColor := class(TSXml).CurCodePageToUtf8(str); + End; + + Property ColorIndex read readXMLColorIndex write writeXMLColorIndex; + Function readXMLColorIndex(); + Begin + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('ColorIndex')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLColorIndex); + End; + + Function writeXMLColorIndex(str); + Begin + XMLColorIndex := class(TSXml).CurCodePageToUtf8(str); + End; + + Property ThemeColor read readXMLThemeColor write writeXMLThemeColor; + Function readXMLThemeColor(); + Begin + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('ThemeColor')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLThemeColor); + End; + + Function writeXMLThemeColor(str); + Begin + XMLThemeColor := class(TSXml).CurCodePageToUtf8(str); + End; + + Property ThemeColorTint read readXMLThemeColorTint write writeXMLThemeColorTint; + Function readXMLThemeColorTint(); + Begin + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('ThemeColorTint')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLThemeColorTint); + End; + + Function writeXMLThemeColorTint(str); + Begin + XMLThemeColorTint := class(TSXml).CurCodePageToUtf8(str); + End; + Function GetAttrs(); override; Begin HandleAttrs(); - return array(("Position", "position", Position, "")) union ExtAttr; + return array(("Position", "position", XMLPosition, "")) union ExtAttr; End; Function GetChildren(); override; Begin HandleChildren(); - return array(("field":"Color","name":"color","obj":Color,"attrEx":"rgb","nodeType":"","attrName":"", "desc":"", "class":"") - ,("field":"ColorIndex","name":"color","obj":ColorIndex,"attrEx":"index","nodeType":"","attrName":"", "desc":"", "class":"") - ,("field":"ThemeColor","name":"color","obj":ThemeColor,"attrEx":"theme","nodeType":"","attrName":"", "desc":"", "class":"") + return array(("field":"Color","name":"color","obj":XMLColor,"attrEx":"rgb","nodeType":"","attrName":"", "desc":"", "class":"") + ,("field":"ColorIndex","name":"color","obj":XMLColorIndex,"attrEx":"index","nodeType":"","attrName":"", "desc":"", "class":"") + ,("field":"ThemeColor","name":"color","obj":XMLThemeColor,"attrEx":"theme","nodeType":"","attrName":"", "desc":"", "class":"") + ,("field":"ThemeColorTint","name":"color","obj":XMLThemeColorTint,"attrEx":"tint","nodeType":"","attrName":"", "desc":"", "class":"") ) union ExtNodes; End; //Attributes - Position; + XMLPosition; //Nodes - Color; - ColorIndex; - ThemeColor; + XMLColor; + XMLColorIndex; + XMLThemeColor; + XMLThemeColorTint; End; /////////////////////////////////////////////////////////////// @@ -3924,10 +4277,75 @@ type TAlignment=class(NodeInfo) RootObj := node; End; + Property Horizontal read readXMLHorizontal write writeXMLHorizontal; + Function readXMLHorizontal(); + Begin + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('Horizontal')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLHorizontal); + End; + + Function writeXMLHorizontal(str); + Begin + XMLHorizontal := class(TSXml).CurCodePageToUtf8(str); + End; + + Property Vertical read readXMLVertical write writeXMLVertical; + Function readXMLVertical(); + Begin + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('Vertical')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLVertical); + End; + + Function writeXMLVertical(str); + Begin + XMLVertical := class(TSXml).CurCodePageToUtf8(str); + End; + + Property WrapText read readXMLWrapText write writeXMLWrapText; + Function readXMLWrapText(); + Begin + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('WrapText')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLWrapText); + End; + + Function writeXMLWrapText(str); + Begin + XMLWrapText := class(TSXml).CurCodePageToUtf8(str); + End; + + Property ReadingOrder read readXMLReadingOrder write writeXMLReadingOrder; + Function readXMLReadingOrder(); + Begin + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('ReadingOrder')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLReadingOrder); + End; + + Function writeXMLReadingOrder(str); + Begin + XMLReadingOrder := class(TSXml).CurCodePageToUtf8(str); + End; + + Property TextRotation read readXMLTextRotation write writeXMLTextRotation; + Function readXMLTextRotation(); + Begin + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('TextRotation')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLTextRotation); + End; + + Function writeXMLTextRotation(str); + Begin + XMLTextRotation := class(TSXml).CurCodePageToUtf8(str); + End; + Function GetAttrs(); override; Begin HandleAttrs(); - return array(("Horizontal", "horizontal", Horizontal, ""),("Vertical", "vertical", Vertical, ""),("WrapText", "wrapText", WrapText, ""),("ReadingOrder", "readingOrder", ReadingOrder, ""),("TextRotation", "textRotation", TextRotation, "")) union ExtAttr; + return array(("Horizontal", "horizontal", XMLHorizontal, ""),("Vertical", "vertical", XMLVertical, ""),("WrapText", "wrapText", XMLWrapText, ""),("ReadingOrder", "readingOrder", XMLReadingOrder, ""),("TextRotation", "textRotation", XMLTextRotation, "")) union ExtAttr; End; Function GetChildren(); override; @@ -3937,11 +4355,11 @@ type TAlignment=class(NodeInfo) End; //Attributes - Horizontal; - Vertical; - WrapText; - ReadingOrder; - TextRotation; + XMLHorizontal; + XMLVertical; + XMLWrapText; + XMLReadingOrder; + XMLTextRotation; //Nodes End; @@ -3971,10 +4389,36 @@ type TProtection=class(NodeInfo) RootObj := node; End; + Property Lock read readXMLLock write writeXMLLock; + Function readXMLLock(); + Begin + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('Lock')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLLock); + End; + + Function writeXMLLock(str); + Begin + XMLLock := class(TSXml).CurCodePageToUtf8(str); + End; + + Property Hide read readXMLHide write writeXMLHide; + Function readXMLHide(); + Begin + tmpVal := class(TSXml).Utf8ToCurCodePage(Value('Hide')); + if not ifNil(tmpVal) then return tmpVal; + return class(TSXml).Utf8ToCurCodePage(XMLHide); + End; + + Function writeXMLHide(str); + Begin + XMLHide := class(TSXml).CurCodePageToUtf8(str); + End; + Function GetAttrs(); override; Begin HandleAttrs(); - return array(("Lock", "locked", Lock, ""),("Hide", "hidden", Hide, "")) union ExtAttr; + return array(("Lock", "locked", XMLLock, ""),("Hide", "hidden", XMLHide, "")) union ExtAttr; End; Function GetChildren(); override; @@ -3984,8 +4428,8 @@ type TProtection=class(NodeInfo) End; //Attributes - Lock; - Hide; + XMLLock; + XMLHide; //Nodes End; @@ -4045,6 +4489,22 @@ type TStyle=class(NodeInfo) ) union ExtNodes; End; + Function Apply(); + Begin + children := GetChildren(); + for i:=0 to length(children)-1 do + begin + obj := children[i]["obj"]; + if ifObj(obj) then + begin + root := obj.Root(); + if not ifObj(root) then continue; + marshal := obj.Marshal(); + class(TSXml).UpdateNode(root, marshal["attributes"], marshal["children"]); + end + end + End; + //Attributes //Nodes @@ -14420,140 +14880,4 @@ Begin if cnt and (str[1] in spaceArr or (cnt > 1 and str[cnt] in spaceArr)) then return true; return false; -End;/////////////////////////////////////////////////////////////////////////////////////////// -///XLSX文档实现 - -Type TGradient = class(TGradientImpl) - - Function Create(); - Begin - Class(TGradientImpl).Create(); - End; - - Function HandleAttrs(); override; - Begin - case Shading of - 0: degree := 90; - 1: degree := 270; - 2: degree := 90; - 3: degree := nil; - 4: degree := 180; - 5: degree := nil; - 6: degree := 45; - 7: degree := 225; - 8: degree := 45; - 9: degree := 135; - 10: degree := 315; - 11: degree := 135; - 12: - begin - degree := nil; - type := "path"; - end - 13: - begin - degree := nil; - type := "path"; - left := 1; - right := 1; - end - 14: - begin - degree := nil; - type := "path"; - top := 1; - bottom := 1; - end - 15: - begin - degree := nil; - type := "path"; - left := 1; - right := 1; - top := 1; - bottom := 1; - end - 16: - begin - degree := nil; - type := "path"; - left := 0.5; - right := 0.5; - top := "0.5"; - bottom := 0.5; - end - end - End - - Function HandleChildren(); override; - Begin - setColor(); - End - - Function GetAttrs(); override; - Begin - HandleAttrs(); - return array( - ('degree', 'degree', degree), - ('type', 'type', type), - ('left', 'left', left), - ('right', 'right', right), - ('top', 'top', top), - ('bottom', 'bottom', bottom), - ) union ExtAttr; - End - - Function GetChildren(); override; - Begin - HandleChildren(); - return array( - ('field': 'stop', 'name': 'stop', 'obj': topPosition, 'attrEx': '', 'nodeType': '', 'attrName': ''), - ('field': 'stop', 'name': 'stop', 'obj': middlePosition, 'attrEx': '', 'nodeType': '', 'attrName': ''), - ('field': 'stop', 'name': 'stop', 'obj': bottomPosition, 'attrEx': '', 'nodeType': '', 'attrName': ''), - ) union ExtNodes; - End - -private - - Function setColor(); - Begin - if ifnil(Shading) then return; - topPosition := new TStop(); - topPosition.Position := 0; - bottomPosition := new TStop(); - bottomPosition.Position := 1; - middlePosition := new TStop(); - - if not ifnil(Color1) then topPosition.Color := Color1; - else topPosition.ThemeColor := ThemeColor1 ? : "0"; - - if Shading in array(2, 5, 8, 11) then - begin - middlePosition.Position := 0.5; - if not ifnil(Color2) then middlePosition.Color := Color2; - else middlePosition.ThemeColor := ThemeColor2 ? : "0"; - if not ifnil(Color1) then bottomPosition.Color := Color1; - else bottomPosition.ThemeColor := ThemeColor1 ? : "0"; - end - else begin - if not ifnil(Color2) then bottomPosition.Color := Color2; - else bottomPosition.ThemeColor := ThemeColor2 ? : "0"; - end - End - -private - // Attributes - type; - degree; - left; - right; - top; - bottom; - - // Nodes - topPosition; - bottomPosition; - middlePosition; - -End - +End; diff --git a/funcext/TSOffice/TSDocxFile.tsf b/funcext/TSOffice/TSDocxFile.tsf index 96635ea..bad2d24 100644 --- a/funcext/TSOffice/TSDocxFile.tsf +++ b/funcext/TSOffice/TSDocxFile.tsf @@ -1,4 +1,4 @@ -// Version 1.2.1 +// Version 1.2.2 Type TSDocxFile = Class ///Version: V1.0 2022-09-20 @@ -487,4 +487,3 @@ private numberingObj_; DocPrId_; End; - diff --git a/funcext/TSOffice/TSExcelFile.tsf b/funcext/TSOffice/TSExcelFile.tsf index d9dbcab..fa2e044 100644 --- a/funcext/TSOffice/TSExcelFile.tsf +++ b/funcext/TSOffice/TSExcelFile.tsf @@ -1,4 +1,4 @@ -// Version 1.2.1 +// Version 1.2.2 Type TSExcelFile = Class ///Version: V1.0 2022-08-08 @@ -199,6 +199,15 @@ Type TSExcelFile = Class return array(err, value); End; + ///获取单元格数据类型 + ///sheet: string,工作表名称 + ///axis: string,单元格坐标,如: "A6" + ///返回: type:string + Function GetCellValueType(sheet, axis); + Begin + return workbook_.GetCellValueType(class(TSXml).CurCodePageToUtf8(sheet), axis); + End; + ///设置单元格的值 ///sheet: string,工作表名称 ///axis: string,单元格坐标,如: "A6" @@ -442,6 +451,19 @@ Type TSExcelFile = Class if ifObj(o) then o.AddComment(axis, Author, comment); End; + ///获取批注 + ///sheet: string,工作表名称 + ///axis: string,单元格,如"A7" + ///返回: [author:string, comment: string] + Function GetComment(sheet, axis); + Begin + author := ''; + comment := ''; + o := getOj(sheet, 'xlsxComment'); + if ifObj(o) then [author, comment] := o.GetComment(axis); + return array(class(TSXml).Utf8ToCurCodePage(author), class(TSXml).Utf8ToCurCodePage(comment)); + End; + ///添加图表 ///sheet: string,工作表名称 ///range:string,图表所处矩形区域,"A5:F10" @@ -531,6 +553,14 @@ Type TSExcelFile = Class return styleObj.GetStyleId(style); End; + ///获取样式对象 + ///返回: TStyle对象 + Function GetStyle(styleid); + Begin + styleObj := new xlsxStyles('', self); + return styleObj.GetStyle(styleid); + End; + ///设置单元格样式 ///sheet: string,工作表名称 ///topLeft: string,左上角坐标 @@ -753,8 +783,8 @@ Type TSExcelFile = Class ///添加图片 ///sheet: string, 工作表名称 - ///topLeft: string, 图片插入左上角单元格 - ///bottomRight: string, 图片插入右下角单元格 + ///topLeft: string, 图片插入左上角单元格 + ///bottomRight: string, 图片插入右下角单元格 ///picture: TPicture 图片对象 ///format: TPictureFormat 图片设置对象 Function AddPicture(sheet, topLeft, bottomRight, picture, format); @@ -765,19 +795,19 @@ Type TSExcelFile = Class ///删除图片 ///sheet: 工作表名称 - ///topLeft: string, 图片插入左上角单元格 - ///bottomRight: string, 图片插入右下角单元格 + ///topLeft: string, 图片插入左上角单元格 + ///bottomRight: string, 图片插入右下角单元格 Function DeletePicture(sheet, topLeft, bottomRight); Begin o := getOj(sheet, 'xlsxImage'); if ifObj(o) then return o.DeletePicture(topLeft, bottomRight); End; - ///创建表格 + ///创建表格 ///sheet: string,工作表名称 - ///topLeft: string, 左上角单元格 - ///bottomRight: string, 右下角单元格 - ///tableStyle: 表格选项类 TTableStyle + ///topLeft: string, 左上角单元格 + ///bottomRight: string, 右下角单元格 + ///tableStyle: 表格选项类 TTableStyle ///[includeHeader: bool] 是否包括表头,默认FALSE Function AddTable(sheet, topLeft, bottomRight, tableStyle, includeHeader); Begin @@ -803,8 +833,8 @@ Type TSExcelFile = Class ///添加形状 ///sheet: string,工作表名称 - ///topLeft: string, 左上角单元格 - ///bottomRight: string, 右下角单元格 + ///topLeft: string, 左上角单元格 + ///bottomRight: string, 右下角单元格 ///shapeType: string, 形状类型 ///format: 形状设置,TShapeFormat类 Function AddShape(sheet, topLeft, bottomRight, shapeType, format); @@ -813,7 +843,7 @@ Type TSExcelFile = Class if ifObj(o) then return o.AddShape(topLeft, bottomRight, shapeType, format); End; - ///设置工作簿的核心属性 + ///设置工作簿的核心属性 ///coreProps: TCoreProperty对象 Function SetCoreProps(coreProps); Begin @@ -896,6 +926,48 @@ Type TSExcelFile = Class return workbook_.GetCalcOptions(); End; + ///创建行的分级显示,根据给定的工作表、行号和分级参数创建组 + ///sheet: string, 工作表名称 + ///row: int, 行号 + ///level: int, 分级参数 + Function SetRowOutlineLevel(sheet, row, level); + Begin + return workbook_.SetRowOutlineLevel(class(TSXml).CurCodePageToUtf8(sheet), row, level); + End; + + ///获取行的分级参数 + ///sheet: string, 工作表名称 + ///row: int, 行号 + ///返回: int,分级参数,分级不存在返回0 + Function GetRowOutlineLevel(sheet, row); + Begin + return workbook_.GetRowOutlineLevel(class(TSXml).CurCodePageToUtf8(sheet), row); + End; + + /// + + ///创建列的分级显示,根据给定的工作表、列名和分级参数创建组 + ///sheet: string, 工作表名称 + ///col: string, 列名 + ///level: int, 分级参数 + Function SetColOutlineLevel(sheet, col, level); + Begin + [err, col] := ColumnNameToNumber(col); + if err then return "Col error."; + return workbook_.SetColOutlineLevel(class(TSXml).CurCodePageToUtf8(sheet), col, level); + End; + + ///获取列的分级参数 + ///sheet: string, 工作表名称 + ///col: string, 列名 + ///返回: int,分级参数,分级不存在返回0 + Function GetColOutlineLevel(sheet, col); + Begin + [err, col] := ColumnNameToNumber(col); + if err then return "Col error."; + return workbook_.GetColOutlineLevel(class(TSXml).CurCodePageToUtf8(sheet), col); + End; + Function WorkBook(); Begin return workbook_; @@ -948,4 +1020,3 @@ private workbook_; //WorkBook对象 objMgr_; //各种对象缓存、管理 End; - diff --git a/funcext/TSOffice/document/TTableContent.tsf b/funcext/TSOffice/document/TTableContent.tsf index 22109eb..7dac361 100644 --- a/funcext/TSOffice/document/TTableContent.tsf +++ b/funcext/TSOffice/document/TTableContent.tsf @@ -276,15 +276,9 @@ Type TTableContent = class z := docx_.Zip(); xml := z.Get('word/' + name); if not ifObj(xml) then Begin - path := docx_.GetPath(); - if path[1] = '/' then Begin - fName := path + '/funcext/TSOffice/template/' + name; - End - else Begin - fName := path + '\\funcext\\TSOffice\\template\\' + name; - End; - if not ReadFile(rwraw(), '', fName, 0, 100 * 1024, xmlData) then - return; + xmlData := TOfficeTemplate(name); + if not ifString(xmlData) then + return ; z.Add('word/' + name, xmlData); rels := 'word/_rels/document.xml.rels'; relsObj := z.Get(rels); diff --git a/funcext/TSOffice/worksheet/xlsxComment.tsf b/funcext/TSOffice/worksheet/xlsxComment.tsf index c83548b..99fe527 100644 --- a/funcext/TSOffice/worksheet/xlsxComment.tsf +++ b/funcext/TSOffice/worksheet/xlsxComment.tsf @@ -60,6 +60,7 @@ xmlns:v="urn:schemas-microsoft-com:vml"> authors_[ author ] := i ++; node := node.NextElement(); End; + initCommentObjs(); //println('sheet={},commentfile={},vmlfile={}',sheet, commentXmlFile_, drawingVML_); End; @@ -95,12 +96,13 @@ xmlns:v="urn:schemas-microsoft-com:vml"> commentObj.Font.Bold := nil; commentObj.Space := 'preserve'; domData := comments.Marshal(); - node := getComment(cell); - if ifObj(node) then + node := commentObjs_[cell]; + if ifObj(node) then node.DeleteChildren(); else node := commentXmlFile_.FirstChildElement('comments').FirstChildElement('commentList').InsertEndChild('element', 'comment'); node.UnMarshal(domData); + commentObjs_[cell] := node; //commentXmlFile_.print; innerxml := '