v1.2.2
This commit is contained in:
parent
894303ccef
commit
3d68bf2256
|
|
@ -56,9 +56,11 @@ style.Border.Top.LineStyle := "double";
|
||||||
style.Border.Top.Color := "FF0000";
|
style.Border.Top.Color := "FF0000";
|
||||||
style.Alignment.Horizontal := "center";
|
style.Alignment.Horizontal := "center";
|
||||||
style.Alignment.Vertical := "center";
|
style.Alignment.Vertical := "center";
|
||||||
style.Fill.Gradient.Shading := 3;
|
style.Fill.Gradient.Degree := 0;
|
||||||
style.Fill.Gradient.Color1 := "FFFFFF";
|
style.Fill.Gradient.Stop1.Position := 0;
|
||||||
style.Fill.Gradient.Color2 := "E0EBF5";
|
style.Fill.Gradient.Stop1.Color := "FFFFFF";
|
||||||
|
style.Fill.Gradient.Stop2.Position := 1;
|
||||||
|
style.Fill.Gradient.Stop2.Color := "E0EBF5";
|
||||||
|
|
||||||
styleId := file.NewStyle(style);
|
styleId := file.NewStyle(style);
|
||||||
PrintSuccess("NewStyle", testing++);
|
PrintSuccess("NewStyle", testing++);
|
||||||
|
|
@ -223,9 +225,15 @@ Begin
|
||||||
style.Font.Size := 14;
|
style.Font.Size := 14;
|
||||||
style.Font.Bold := True;
|
style.Font.Bold := True;
|
||||||
style.Font.UnderLine := 'singleAccounting';
|
style.Font.UnderLine := 'singleAccounting';
|
||||||
style.Fill.Gradient.Shading := 16;
|
style.Fill.Gradient.Type := 'path';
|
||||||
style.Fill.Gradient.Color1 := 'A3ECFB';
|
style.Fill.Gradient.Left := 0.5;
|
||||||
style.Fill.Gradient.Color2 := '626AD8';
|
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);
|
styleid1 := excel.NewStyle(style);
|
||||||
|
|
||||||
style := TOfficeObj('TStyle');
|
style := TOfficeObj('TStyle');
|
||||||
|
|
@ -487,9 +495,11 @@ style.NumberFormat.FormatCode := '#,##0.000_ ';
|
||||||
//style.Fill.Pattern.PatternType := 'solid';
|
//style.Fill.Pattern.PatternType := 'solid';
|
||||||
//style.Fill.Pattern.ForegroundColor := 'FF6699FF';
|
//style.Fill.Pattern.ForegroundColor := 'FF6699FF';
|
||||||
//style.Fill.Pattern.BackgroundColor := 'FFFF0000';
|
//style.Fill.Pattern.BackgroundColor := 'FFFF0000';
|
||||||
style.Fill.Gradient.ThemeColor1 := 0;
|
style.Fill.Gradient.Degree := 270;
|
||||||
style.Fill.Gradient.ThemeColor2 := 4;
|
style.Fill.Gradient.Stop1.Position := 0;
|
||||||
style.Fill.Gradient.Shading := 1;
|
style.Fill.Gradient.Stop1.ThemeColor := 0;
|
||||||
|
style.Fill.Gradient.Stop2.Position := 1;
|
||||||
|
style.Fill.Gradient.Stop2.ThemeColor := 4;
|
||||||
style.Protection.Hide := 1;
|
style.Protection.Hide := 1;
|
||||||
style.Protection.Lock := 1;
|
style.Protection.Lock := 1;
|
||||||
";
|
";
|
||||||
|
|
@ -596,29 +606,25 @@ style.Protection.Lock := 1;
|
||||||
('ObjName': 'TGradient',
|
('ObjName': 'TGradient',
|
||||||
'Desc': ('TGradient有以下属性: '),
|
'Desc': ('TGradient有以下属性: '),
|
||||||
'AttrInfo': (
|
'AttrInfo': (
|
||||||
('attrName': '', 'type': '', 'desc': '{颜色1}:渐变的第一种颜色,{Color1}和{ThemeColor1}只能设置一种', 'value': array()),
|
('attrName': 'Degree', 'type': 'int', 'desc': '渐变的角度(水平、垂直、斜上、斜下)', 'value': array(0, 45, 90, 135, 180, 225, 270, 315)),
|
||||||
('attrName': 'Color1', 'type': 'string', 'desc': 'RGB颜色', 'value': array()),
|
('attrName': 'Type', 'type': 'string', 'desc': '辐射渐变,采用辐射渐变时,不需设置{Degree}', 'value': array('path')),
|
||||||
('attrName': 'ThemeColor1', 'type': 'int', 'desc': '主题颜色', 'value': array()),
|
('attrName': 'Left', 'type': 'string', 'desc': '辐射渐变时需设置属性', 'value': array()),
|
||||||
('attrName': '', 'type': '', 'desc': '{颜色2}:渐变的第一种颜色,{Color2}和{ThemeColor2}只能设置一种', 'value': array()),
|
('attrName': 'Right', 'type': 'string', 'desc': '辐射渐变时需设置属性', 'value': array()),
|
||||||
('attrName': 'Color2', 'type': 'string', 'desc': 'RGB颜色', 'value': array()),
|
('attrName': 'Top', 'type': 'string', 'desc': '辐射渐变时需设置属性', 'value': array()),
|
||||||
('attrName': 'ThemeColor2', 'type': 'int', 'desc': '主题颜色', 'value': array()),
|
('attrName': 'Bottom', 'type': 'string', 'desc': '辐射渐变时需设置属性', 'value': array()),
|
||||||
('attrName': 'Shading', 'type': 'int', 'desc': '底纹样式', 'value': array('0: 水平渐变,颜色1从上到下渐变到颜色2', '1: 水平渐变,颜色2从上到下渐变到颜色1',
|
('attrName': 'Stop1', 'type': 'class - TStop', 'desc': '渐变点需要设置的信息', 'value': array()),
|
||||||
'2: 水平渐变,三层颜色,颜色1从上渐变到中间颜色2,再从颜色2渐变到底部颜色1',
|
('attrName': 'Stop2', 'type': 'class - TStop', 'desc': '渐变点需要设置的信息', 'value': array()),
|
||||||
'3: 垂直渐变,颜色1从左到右渐变到颜色2',
|
('attrName': 'Stop3', 'type': 'class - TStop', 'desc': '渐变点需要设置的信息', 'value': array()),
|
||||||
'4: 垂直渐变,颜色2从右到左渐变到颜色1',
|
),
|
||||||
'5: 垂直渐变,三层颜色,颜色1从左渐变到中间颜色2,再从颜色2渐变到右边颜色1',
|
'Demo': '',
|
||||||
'6: 斜上渐变,颜色1左上渐变到右下颜色2',
|
),
|
||||||
'7: 斜上渐变,颜色2左上渐变到右下颜色1',
|
('ObjName': 'TStop',
|
||||||
'8: 斜上渐变,三层颜色,颜色1从左上渐变到对角线颜色2,再从颜色2渐变到右下颜色1',
|
'Desc': ('TStop有以下属性: '),
|
||||||
'9: 斜下渐变,颜色1右上渐变到左下颜色2',
|
'AttrInfo': (
|
||||||
'10: 斜下渐变,颜色2左上渐变到右下颜色1',
|
('attrName': 'Position', 'type': 'double', 'desc': '', 'value': array()),
|
||||||
'11: 斜下渐变,三层颜色,颜色1从左上渐变到对角线颜色2,再从颜色2渐变到右下颜色1',
|
('attrName': 'Color', 'type': 'string', 'desc': 'RGB颜色', 'value': array()),
|
||||||
'12: 角部辐射渐变,颜色1左上角辐射渐变到右下角2',
|
('attrName': 'ThemeColor', 'type': 'int', 'desc': '主题颜色', 'value': array()),
|
||||||
'13: 角部辐射渐变,颜色1右上角辐射渐变到左下角颜色2',
|
('attrName': 'ThemeColorTint', 'type': 'int', 'desc': '主题颜色的色调', 'value': array()),
|
||||||
'14: 角部辐射渐变,颜色1左下角辐射渐变到右上角2',
|
|
||||||
'15: 角部辐射渐变,颜色1右下角辐射渐变到左上角颜色2',
|
|
||||||
'16: 中心辐射渐变,颜色1从中心向四周辐射到颜色2',
|
|
||||||
)),
|
|
||||||
),
|
),
|
||||||
'Demo': '',
|
'Demo': '',
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
TOfficeApi().CodePage('中文');
|
TOfficeApi().CodePage('中文');
|
||||||
|
|
||||||
testCount := 0;
|
testCount := 0;
|
||||||
sheetName := "你好";
|
sheetName := "你好";
|
||||||
sheetName2 := "中文";
|
sheetName2 := "中文";
|
||||||
|
|
||||||
// OpenFile
|
// OpenFile
|
||||||
excel := new TSExcelFile();
|
excel := new TSExcelFile();
|
||||||
|
|
@ -43,6 +43,14 @@ println("[success] GetSheetName = {}", Name);
|
||||||
excel.NewSheet(sheetName2);
|
excel.NewSheet(sheetName2);
|
||||||
println("[success] NewSheet");
|
println("[success] NewSheet");
|
||||||
|
|
||||||
|
// NewSheet
|
||||||
|
excel.NewSheet(sheetName, 'sheet_copy');
|
||||||
|
println("[success] NewSheet2");
|
||||||
|
|
||||||
|
// InsertSheet
|
||||||
|
excel.InsertSheet(sheetName, sheetName + 'before');
|
||||||
|
println("[success] NewSheet2");
|
||||||
|
|
||||||
// GetSheets
|
// GetSheets
|
||||||
sheets := excel.GetSheets();
|
sheets := excel.GetSheets();
|
||||||
println("[success] sheets = {}", sheets);
|
println("[success] sheets = {}", sheets);
|
||||||
|
|
@ -54,7 +62,7 @@ println("[success] DeleteSheet");
|
||||||
|
|
||||||
// SetCellValue
|
// SetCellValue
|
||||||
excel.SetCellValue(sheetName, "A1", 100);
|
excel.SetCellValue(sheetName, "A1", 100);
|
||||||
excel.SetCellValue(sheetName, "F1", "中文的壹佰");
|
excel.SetCellValue(sheetName, "F1", "中文的壹佰");
|
||||||
println("[success] SetCellValue");
|
println("[success] SetCellValue");
|
||||||
|
|
||||||
// GetCellValue
|
// GetCellValue
|
||||||
|
|
@ -63,6 +71,10 @@ PrintInfo("GetCellValue A1 ", err, errmsg);
|
||||||
[err, errmsg] := excel.GetCellValue(sheetName, "F1");
|
[err, errmsg] := excel.GetCellValue(sheetName, "F1");
|
||||||
PrintInfo("GetCellValue F1 ", err, errmsg);
|
PrintInfo("GetCellValue F1 ", err, errmsg);
|
||||||
|
|
||||||
|
// GetCellValue
|
||||||
|
[err, errmsg] := excel.GetCellRawValue(sheetName, "A1");
|
||||||
|
PrintInfo("GetCellRawValue A1 ", err, errmsg);
|
||||||
|
|
||||||
// TotalCols
|
// TotalCols
|
||||||
totalCols := excel.TotalCols(sheetName);
|
totalCols := excel.TotalCols(sheetName);
|
||||||
println("[success] TotalCols = {}", totalCols);
|
println("[success] TotalCols = {}", totalCols);
|
||||||
|
|
@ -73,7 +85,7 @@ println("[success] TotalRows = {}", totalRows);
|
||||||
|
|
||||||
// SetCellRichText
|
// SetCellRichText
|
||||||
richText := TOfficeObj('TRichtext');
|
richText := TOfficeObj('TRichtext');
|
||||||
text1 := richText.AddText('Hello 你好');
|
text1 := richText.AddText('Hello 你好');
|
||||||
text1.Font.Size := 35;
|
text1.Font.Size := 35;
|
||||||
text1.Font.Color := "FFF000";
|
text1.Font.Color := "FFF000";
|
||||||
text2 := richText.AddText(" World");
|
text2 := richText.AddText(" World");
|
||||||
|
|
@ -93,7 +105,7 @@ excel.ClearCell(sheetName, "A1");
|
||||||
println("[success] ClearCell");
|
println("[success] ClearCell");
|
||||||
|
|
||||||
// SetCellFormula
|
// SetCellFormula
|
||||||
excel.SetCellFormula(sheetName, "A2", "=100*50");
|
excel.SetCellFormula(sheetName, "A2", "100*50");
|
||||||
println("[success] SetCellFormula");
|
println("[success] SetCellFormula");
|
||||||
|
|
||||||
// GetCellFormula
|
// GetCellFormula
|
||||||
|
|
@ -105,7 +117,7 @@ excel.SetSheetRow(sheetName, "C3", array(1, 2, 3, 4, "a", "b"));
|
||||||
println("[success] SetSheetRow");
|
println("[success] SetSheetRow");
|
||||||
|
|
||||||
// InsertTable
|
// 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));
|
//table2 := array(("title1" :1, "title2": 2), ("title1": 3, "title2": 4));
|
||||||
[err, errmsg] := excel.InsertTable(sheetName, "A5", table);
|
[err, errmsg] := excel.InsertTable(sheetName, "A5", table);
|
||||||
PrintInfo("InsertTable", err, errmsg);
|
PrintInfo("InsertTable", err, errmsg);
|
||||||
|
|
@ -219,6 +231,12 @@ PrintInfo("ColumnNumberToName", err, errmsg);
|
||||||
[err, col, row] := excel.CellNameToCoordinates("A2");
|
[err, col, row] := excel.CellNameToCoordinates("A2");
|
||||||
if not err then println("[success] {} = col : {}, row = {}", "CellNameToCoordinates", col, row);
|
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
|
// RGBToHSL
|
||||||
[h, s, l] := excel.RGBToHSL(255, 15, 33);
|
[h, s, l] := excel.RGBToHSL(255, 15, 33);
|
||||||
println("[success] {} = {}, {}, {}", "RGBToHSL", h, s, l);
|
println("[success] {} = {}, {}, {}", "RGBToHSL", h, s, l);
|
||||||
|
|
@ -231,7 +249,7 @@ println("[success] {} = {}, {}, {}", "HSLToRGB", r, g, b);
|
||||||
style := TOfficeObj('TStyle');
|
style := TOfficeObj('TStyle');
|
||||||
style.Font.Color := "A020F0";
|
style.Font.Color := "A020F0";
|
||||||
style.Font.Size := 22;
|
style.Font.Size := 22;
|
||||||
style.Font.Name := "黑体";
|
style.Font.Name := "黑体";
|
||||||
style.Font.Bold := True;
|
style.Font.Bold := True;
|
||||||
style.Font.Charset := "134";
|
style.Font.Charset := "134";
|
||||||
style.Font.Script := "subscript";
|
style.Font.Script := "subscript";
|
||||||
|
|
@ -259,9 +277,11 @@ style.NumberFormat.FormatCode := "#,##0.000_ ";
|
||||||
//style.Fill.Pattern.PatternType := "solid";
|
//style.Fill.Pattern.PatternType := "solid";
|
||||||
//style.Fill.Pattern.ForegroundColor := "FF6699FF";
|
//style.Fill.Pattern.ForegroundColor := "FF6699FF";
|
||||||
//style.Fill.Pattern.BackgroundColor := "FFFF0000";
|
//style.Fill.Pattern.BackgroundColor := "FFFF0000";
|
||||||
style.Fill.Gradient.ThemeColor1 := 0;
|
style.Fill.Gradient.Degree := 270;
|
||||||
style.Fill.Gradient.ThemeColor2 := 4;
|
style.Fill.Gradient.Stop1.Position := 0;
|
||||||
style.Fill.Gradient.Shading := 1;
|
style.Fill.Gradient.Stop1.ThemeColor := 0;
|
||||||
|
style.Fill.Gradient.Stop2.Position := 1;
|
||||||
|
style.Fill.Gradient.Stop2.ThemeColor := 4;
|
||||||
style.Protection.Hide := 1;
|
style.Protection.Hide := 1;
|
||||||
style.Protection.Lock := 1;
|
style.Protection.Lock := 1;
|
||||||
|
|
||||||
|
|
@ -277,6 +297,31 @@ println("[success] GetCellStyle = {}", styleid);
|
||||||
styleid := excel.GetCellStyle(sheetName, "D4");
|
styleid := excel.GetCellStyle(sheetName, "D4");
|
||||||
println("[success] GetCellStyle = {}", styleid);
|
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
|
// SetSheetHeaderFooter
|
||||||
headerFooter := TOfficeObj("THeaderFooter");
|
headerFooter := TOfficeObj("THeaderFooter");
|
||||||
headerFooter.DifferentOddEven := true;
|
headerFooter.DifferentOddEven := true;
|
||||||
|
|
@ -332,8 +377,8 @@ println("[success] SetPageMargins");
|
||||||
// GetPageMargins
|
// GetPageMargins
|
||||||
margins := excel.GetPageMargins(sheetName2);
|
margins := excel.GetPageMargins(sheetName2);
|
||||||
println("[success] GetPageMargins top = {}, bottom = {}, left = {}, right = {}, header = {}, footer = {}",
|
println("[success] GetPageMargins top = {}, bottom = {}, left = {}, right = {}, header = {}, footer = {}",
|
||||||
margins.Value('Top'), margins.Value('Bottom'), margins.Value('Left'), margins.Value('Right'),
|
margins.Top, margins.Bottom, margins.Left, margins.Right,
|
||||||
margins.Value('Header'), margins.Value('Footer'));
|
margins.Header, margins.Footer);
|
||||||
|
|
||||||
// MergeCell
|
// MergeCell
|
||||||
excel.SetCellStyle(sheetName2, "A4", "A4", styleid1);
|
excel.SetCellStyle(sheetName2, "A4", "A4", styleid1);
|
||||||
|
|
@ -372,6 +417,7 @@ println("[success] SetPane");
|
||||||
pageLayout := TOfficeObj('TPageLayout');
|
pageLayout := TOfficeObj('TPageLayout');
|
||||||
pageLayout.FitToWidth := 10;
|
pageLayout.FitToWidth := 10;
|
||||||
pageLayout.FitToHeight := 10;
|
pageLayout.FitToHeight := 10;
|
||||||
|
pageLayout.UseFirstPageNumber := true;
|
||||||
pageLayout.FirstPageNumber := 5;
|
pageLayout.FirstPageNumber := 5;
|
||||||
pageLayout.Orientation := "portrait";
|
pageLayout.Orientation := "portrait";
|
||||||
pageLayout.BlackAndWhite := true;
|
pageLayout.BlackAndWhite := true;
|
||||||
|
|
@ -402,8 +448,8 @@ excel.SetCellHyperLink(sheetName2, 'A1', link);
|
||||||
link := TOfficeObj('THyperLink');
|
link := TOfficeObj('THyperLink');
|
||||||
link.LinkType := "external";
|
link.LinkType := "external";
|
||||||
link.LinkUrl := "https://www.baidu.com";
|
link.LinkUrl := "https://www.baidu.com";
|
||||||
link.Tooltip := "超链接悬浮提示";
|
link.Tooltip := "超链接悬浮提示";
|
||||||
excel.SetCellValue(sheetName2, 'A2', '超链接');
|
excel.SetCellValue(sheetName2, 'A2', '超链接');
|
||||||
excel.SetCellHyperLink(sheetName2, 'A2', link);
|
excel.SetCellHyperLink(sheetName2, 'A2', link);
|
||||||
println("[success] SetCellHyperLink");
|
println("[success] SetCellHyperLink");
|
||||||
|
|
||||||
|
|
@ -431,12 +477,12 @@ println("[success] AddPicture");
|
||||||
excel.DeletePicture(sheetName2, 'A1', 'D17');
|
excel.DeletePicture(sheetName2, 'A1', 'D17');
|
||||||
println("[success] DeletePicture");
|
println("[success] DeletePicture");
|
||||||
|
|
||||||
// TODO 可能有问题
|
// TODO 可能有问题
|
||||||
// AddTable
|
// AddTable
|
||||||
table2 := array(("title1" :1, "title2": 2), ("title1": 3, "title2": 4));
|
table2 := array(("title1" :1, "title2": 2), ("title1": 3, "title2": 4));
|
||||||
excel.InsertTable(sheetName2, "A9", table2, true);
|
excel.InsertTable(sheetName2, "A9", table2, true);
|
||||||
tablestyle := TOfficeObj('TTableStyle');
|
tablestyle := TOfficeObj('TTableStyle');
|
||||||
tablestyle.TableName := "测试表";
|
tablestyle.TableName := "测试表";
|
||||||
tablestyle.TableStyle := "TableStyleMedium2";
|
tablestyle.TableStyle := "TableStyleMedium2";
|
||||||
tablestyle.ShowFirstColumn := True;
|
tablestyle.ShowFirstColumn := True;
|
||||||
tablestyle.ShowLastColumn := True;
|
tablestyle.ShowLastColumn := True;
|
||||||
|
|
@ -466,9 +512,9 @@ println("[success] AddShape");
|
||||||
|
|
||||||
// SetCoreProps
|
// SetCoreProps
|
||||||
core := TOfficeObj('TCoreProperty');
|
core := TOfficeObj('TCoreProperty');
|
||||||
core.Title := "标题";
|
core.Title := "标题";
|
||||||
core.Subject := "主题";
|
core.Subject := "主题";
|
||||||
core.Creator := "作者";
|
core.Creator := "作者";
|
||||||
excel.SetCoreProps(core);
|
excel.SetCoreProps(core);
|
||||||
|
|
||||||
// GetCoreProps
|
// GetCoreProps
|
||||||
|
|
@ -484,8 +530,8 @@ appProps.Company := "TS";
|
||||||
appProps.LinksUpToDate := "true";
|
appProps.LinksUpToDate := "true";
|
||||||
appProps.HyperlinksChanged := "true";
|
appProps.HyperlinksChanged := "true";
|
||||||
appProps.Version := "1.000";
|
appProps.Version := "1.000";
|
||||||
appProps.Manager := "这是主管";
|
appProps.Manager := "这是主管";
|
||||||
//appProps.HyperlinkBase := "这是超链接基础";
|
//appProps.HyperlinkBase := "这是超链接基础";
|
||||||
excel.SetAppProps(appProps);
|
excel.SetAppProps(appProps);
|
||||||
println("[success] SetAppProps");
|
println("[success] SetAppProps");
|
||||||
|
|
||||||
|
|
@ -519,7 +565,7 @@ println("[success] ProtectSheet");
|
||||||
|
|
||||||
// SetDefaultFont
|
// SetDefaultFont
|
||||||
font := tofficeobj('tfont');
|
font := tofficeobj('tfont');
|
||||||
font.Name := '黑体';
|
font.Name := '黑体';
|
||||||
font.Size := 13;
|
font.Size := 13;
|
||||||
font.ThemeColor := 1;
|
font.ThemeColor := 1;
|
||||||
excel.SetDefaultFont(font);
|
excel.SetDefaultFont(font);
|
||||||
|
|
@ -528,6 +574,44 @@ println("[success] SetDefaultFont");
|
||||||
tfont := excel.GetDefaultFont();
|
tfont := excel.GetDefaultFont();
|
||||||
println("[success] GetDefaultFont , name = {}, size = {}, themecolor = {}", tfont.Name, tfont.Size, tfont.ThemeColor);
|
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");
|
[err, errmsg] := excel.saveas("", "d:\\temp\\test.xlsx");
|
||||||
println("saveas : {}", err);
|
println("saveas : {}", err);
|
||||||
|
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -1,4 +1,4 @@
|
||||||
// Version 1.2.1
|
// Version 1.2.2
|
||||||
|
|
||||||
Function TOfficeObj(n);
|
Function TOfficeObj(n);
|
||||||
Begin
|
Begin
|
||||||
|
|
@ -121,10 +121,10 @@ Begin
|
||||||
return new TBorders();
|
return new TBorders();
|
||||||
"tnumfmts":
|
"tnumfmts":
|
||||||
return new TNumFmts();
|
return new TNumFmts();
|
||||||
"tfills":
|
|
||||||
return new TFills();
|
|
||||||
"tgradient":
|
"tgradient":
|
||||||
return new TGradient();
|
return new TGradient();
|
||||||
|
"tfills":
|
||||||
|
return new TFills();
|
||||||
"tpattern":
|
"tpattern":
|
||||||
return new TPattern();
|
return new TPattern();
|
||||||
"tstop":
|
"tstop":
|
||||||
|
|
@ -3560,31 +3560,83 @@ type TBorder=class(NodeInfo)
|
||||||
RootObj := node;
|
RootObj := node;
|
||||||
End;
|
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;
|
Function GetAttrs(); override;
|
||||||
Begin
|
Begin
|
||||||
HandleAttrs();
|
HandleAttrs();
|
||||||
return array(("LineStyle", "style", LineStyle, "")) union ExtAttr;
|
return array(("LineStyle", "style", XMLLineStyle, "")) union ExtAttr;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Function GetChildren(); override;
|
Function GetChildren(); override;
|
||||||
Begin
|
Begin
|
||||||
HandleChildren();
|
HandleChildren();
|
||||||
return array(("field":"Color","name":"color","obj":Color,"attrEx":"rgb","nodeType":"","attrName":"", "desc":"", "class":"")
|
return array(("field":"Color","name":"color","obj":XMLColor,"attrEx":"rgb","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||||
,("field":"ColorIndex","name":"ColorIndex","obj":ColorIndex,"attrEx":"","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":"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":"")
|
,("field":"TintAndShade","name":"tintandshade","obj":TintAndShade,"attrEx":"","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||||
) union ExtNodes;
|
) union ExtNodes;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
//Attributes
|
//Attributes
|
||||||
LineStyle;
|
XMLLineStyle;
|
||||||
|
|
||||||
//Nodes
|
//Nodes
|
||||||
Color;
|
XMLColor;
|
||||||
ColorIndex;
|
XMLThemeColor;
|
||||||
|
XMLThemeColorTint;
|
||||||
Weight;
|
Weight;
|
||||||
ThemeColor;
|
|
||||||
TintAndShade;
|
TintAndShade;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
|
|
@ -3623,6 +3675,32 @@ type TBorders=class(NodeInfo)
|
||||||
Diagonal.InitRootNode(node);
|
Diagonal.InitRootNode(node);
|
||||||
End;
|
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;
|
Function GetAttrs(); override;
|
||||||
Begin
|
Begin
|
||||||
HandleAttrs();
|
HandleAttrs();
|
||||||
|
|
@ -3637,8 +3715,8 @@ type TBorders=class(NodeInfo)
|
||||||
,("field":"Top","name":Top.NodeName,"obj":Top,"attrEx":"","nodeType":"","attrName":"", "desc":"", "class":"TBorder")
|
,("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":"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":"Diagonal","name":Diagonal.NodeName,"obj":Diagonal,"attrEx":"","nodeType":"","attrName":"", "desc":"", "class":"TBorder")
|
||||||
,("field":"DiagonalDown","name":"diagonalDown","obj":DiagonalDown,"attrEx":"","nodeType":"","attrName":"", "desc":"", "class":"")
|
,("field":"DiagonalDown","name":"diagonalDown","obj":XMLDiagonalDown,"attrEx":"","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||||
,("field":"DiagonalUp","name":"diagonalUp","obj":DiagonalUp,"attrEx":"","nodeType":"","attrName":"", "desc":"", "class":"")
|
,("field":"DiagonalUp","name":"diagonalUp","obj":XMLDiagonalUp,"attrEx":"","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||||
) union ExtNodes;
|
) union ExtNodes;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
|
|
@ -3650,8 +3728,8 @@ type TBorders=class(NodeInfo)
|
||||||
Top;
|
Top;
|
||||||
Bottom;
|
Bottom;
|
||||||
Diagonal;
|
Diagonal;
|
||||||
DiagonalDown;
|
XMLDiagonalDown;
|
||||||
DiagonalUp;
|
XMLDiagonalUp;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
|
|
@ -3679,10 +3757,36 @@ type TNumFmts=class(NodeInfo)
|
||||||
RootObj := node;
|
RootObj := node;
|
||||||
End;
|
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;
|
Function GetAttrs(); override;
|
||||||
Begin
|
Begin
|
||||||
HandleAttrs();
|
HandleAttrs();
|
||||||
return array(("NumFmtId", "numFmtId", NumFmtId, ""),("FormatCode", "formatCode", FormatCode, "")) union ExtAttr;
|
return array(("NumFmtId", "numFmtId", XMLNumFmtId, ""),("FormatCode", "formatCode", XMLFormatCode, "")) union ExtAttr;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Function GetChildren(); override;
|
Function GetChildren(); override;
|
||||||
|
|
@ -3692,12 +3796,150 @@ type TNumFmts=class(NodeInfo)
|
||||||
End;
|
End;
|
||||||
|
|
||||||
//Attributes
|
//Attributes
|
||||||
NumFmtId;
|
XMLNumFmtId;
|
||||||
FormatCode;
|
XMLFormatCode;
|
||||||
|
|
||||||
//Nodes
|
//Nodes
|
||||||
End;
|
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
|
/// TFills
|
||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
|
|
@ -3748,53 +3990,6 @@ type TFills=class(NodeInfo)
|
||||||
Gradient;
|
Gradient;
|
||||||
End;
|
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
|
/// TPattern
|
||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
|
|
@ -3820,34 +4015,125 @@ type TPattern=class(NodeInfo)
|
||||||
RootObj := node;
|
RootObj := node;
|
||||||
End;
|
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;
|
Function GetAttrs(); override;
|
||||||
Begin
|
Begin
|
||||||
HandleAttrs();
|
HandleAttrs();
|
||||||
return array(("PatternType", "patternType", PatternType, "")) union ExtAttr;
|
return array(("PatternType", "patternType", XMLPatternType, "")) union ExtAttr;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Function GetChildren(); override;
|
Function GetChildren(); override;
|
||||||
Begin
|
Begin
|
||||||
HandleChildren();
|
HandleChildren();
|
||||||
return array(("field":"ForegroundColor","name":"fgColor","obj":ForegroundColor,"attrEx":"rgb","nodeType":"","attrName":"", "desc":"", "class":"")
|
return array(("field":"ForegroundColor","name":"fgColor","obj":XMLForegroundColor,"attrEx":"rgb","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||||
,("field":"BackgroundColor","name":"bgColor","obj":BackgroundColor,"attrEx":"rgb","nodeType":"","attrName":"", "desc":"", "class":"")
|
,("field":"BackgroundColor","name":"bgColor","obj":XMLBackgroundColor,"attrEx":"rgb","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||||
,("field":"ForegroundThemeColor","name":"fgColor","obj":ForegroundThemeColor,"attrEx":"theme","nodeType":"","attrName":"", "desc":"", "class":"")
|
,("field":"ForegroundThemeColor","name":"fgColor","obj":XMLForegroundThemeColor,"attrEx":"theme","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||||
,("field":"BackgroundThemeColor","name":"bgColor","obj":BackgroundThemeColor,"attrEx":"theme","nodeType":"","attrName":"", "desc":"", "class":"")
|
,("field":"BackgroundThemeColor","name":"bgColor","obj":XMLBackgroundThemeColor,"attrEx":"theme","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||||
,("field":"ForegroundThemeColorTint","name":"fgColor","obj":ForegroundThemeColorTint,"attrEx":"tint","nodeType":"","attrName":"", "desc":"", "class":"")
|
,("field":"ForegroundThemeColorTint","name":"fgColor","obj":XMLForegroundThemeColorTint,"attrEx":"tint","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||||
,("field":"BackgroundThemeColorTint","name":"bgColor","obj":BackgroundThemeColorTint,"attrEx":"tint","nodeType":"","attrName":"", "desc":"", "class":"")
|
,("field":"BackgroundThemeColorTint","name":"bgColor","obj":XMLBackgroundThemeColorTint,"attrEx":"tint","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||||
) union ExtNodes;
|
) union ExtNodes;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
//Attributes
|
//Attributes
|
||||||
PatternType;
|
XMLPatternType;
|
||||||
|
|
||||||
//Nodes
|
//Nodes
|
||||||
ForegroundColor;
|
XMLForegroundColor;
|
||||||
BackgroundColor;
|
XMLBackgroundColor;
|
||||||
ForegroundThemeColor;
|
XMLForegroundThemeColor;
|
||||||
BackgroundThemeColor;
|
XMLBackgroundThemeColor;
|
||||||
ForegroundThemeColorTint;
|
XMLForegroundThemeColorTint;
|
||||||
BackgroundThemeColorTint;
|
XMLBackgroundThemeColorTint;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
|
|
@ -3875,28 +4161,95 @@ type TStop=class(NodeInfo)
|
||||||
RootObj := node;
|
RootObj := node;
|
||||||
End;
|
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;
|
Function GetAttrs(); override;
|
||||||
Begin
|
Begin
|
||||||
HandleAttrs();
|
HandleAttrs();
|
||||||
return array(("Position", "position", Position, "")) union ExtAttr;
|
return array(("Position", "position", XMLPosition, "")) union ExtAttr;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Function GetChildren(); override;
|
Function GetChildren(); override;
|
||||||
Begin
|
Begin
|
||||||
HandleChildren();
|
HandleChildren();
|
||||||
return array(("field":"Color","name":"color","obj":Color,"attrEx":"rgb","nodeType":"","attrName":"", "desc":"", "class":"")
|
return array(("field":"Color","name":"color","obj":XMLColor,"attrEx":"rgb","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||||
,("field":"ColorIndex","name":"color","obj":ColorIndex,"attrEx":"index","nodeType":"","attrName":"", "desc":"", "class":"")
|
,("field":"ColorIndex","name":"color","obj":XMLColorIndex,"attrEx":"index","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||||
,("field":"ThemeColor","name":"color","obj":ThemeColor,"attrEx":"theme","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;
|
) union ExtNodes;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
//Attributes
|
//Attributes
|
||||||
Position;
|
XMLPosition;
|
||||||
|
|
||||||
//Nodes
|
//Nodes
|
||||||
Color;
|
XMLColor;
|
||||||
ColorIndex;
|
XMLColorIndex;
|
||||||
ThemeColor;
|
XMLThemeColor;
|
||||||
|
XMLThemeColorTint;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
|
|
@ -3924,10 +4277,75 @@ type TAlignment=class(NodeInfo)
|
||||||
RootObj := node;
|
RootObj := node;
|
||||||
End;
|
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;
|
Function GetAttrs(); override;
|
||||||
Begin
|
Begin
|
||||||
HandleAttrs();
|
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;
|
End;
|
||||||
|
|
||||||
Function GetChildren(); override;
|
Function GetChildren(); override;
|
||||||
|
|
@ -3937,11 +4355,11 @@ type TAlignment=class(NodeInfo)
|
||||||
End;
|
End;
|
||||||
|
|
||||||
//Attributes
|
//Attributes
|
||||||
Horizontal;
|
XMLHorizontal;
|
||||||
Vertical;
|
XMLVertical;
|
||||||
WrapText;
|
XMLWrapText;
|
||||||
ReadingOrder;
|
XMLReadingOrder;
|
||||||
TextRotation;
|
XMLTextRotation;
|
||||||
|
|
||||||
//Nodes
|
//Nodes
|
||||||
End;
|
End;
|
||||||
|
|
@ -3971,10 +4389,36 @@ type TProtection=class(NodeInfo)
|
||||||
RootObj := node;
|
RootObj := node;
|
||||||
End;
|
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;
|
Function GetAttrs(); override;
|
||||||
Begin
|
Begin
|
||||||
HandleAttrs();
|
HandleAttrs();
|
||||||
return array(("Lock", "locked", Lock, ""),("Hide", "hidden", Hide, "")) union ExtAttr;
|
return array(("Lock", "locked", XMLLock, ""),("Hide", "hidden", XMLHide, "")) union ExtAttr;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Function GetChildren(); override;
|
Function GetChildren(); override;
|
||||||
|
|
@ -3984,8 +4428,8 @@ type TProtection=class(NodeInfo)
|
||||||
End;
|
End;
|
||||||
|
|
||||||
//Attributes
|
//Attributes
|
||||||
Lock;
|
XMLLock;
|
||||||
Hide;
|
XMLHide;
|
||||||
|
|
||||||
//Nodes
|
//Nodes
|
||||||
End;
|
End;
|
||||||
|
|
@ -4045,6 +4489,22 @@ type TStyle=class(NodeInfo)
|
||||||
) union ExtNodes;
|
) union ExtNodes;
|
||||||
End;
|
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
|
//Attributes
|
||||||
|
|
||||||
//Nodes
|
//Nodes
|
||||||
|
|
@ -14420,140 +14880,4 @@ Begin
|
||||||
if cnt and (str[1] in spaceArr or (cnt > 1 and str[cnt] in spaceArr)) then
|
if cnt and (str[1] in spaceArr or (cnt > 1 and str[cnt] in spaceArr)) then
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
End;///////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
///XLSX文档实现
|
|
||||||
|
|
||||||
Type TGradient = class(TGradientImpl)
|
|
||||||
|
|
||||||
Function Create();
|
|
||||||
Begin
|
|
||||||
Class(TGradientImpl).Create();
|
|
||||||
End;
|
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
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Version 1.2.1
|
// Version 1.2.2
|
||||||
|
|
||||||
Type TSDocxFile = Class
|
Type TSDocxFile = Class
|
||||||
///Version: V1.0 2022-09-20
|
///Version: V1.0 2022-09-20
|
||||||
|
|
@ -487,4 +487,3 @@ private
|
||||||
numberingObj_;
|
numberingObj_;
|
||||||
DocPrId_;
|
DocPrId_;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Version 1.2.1
|
// Version 1.2.2
|
||||||
|
|
||||||
Type TSExcelFile = Class
|
Type TSExcelFile = Class
|
||||||
///Version: V1.0 2022-08-08
|
///Version: V1.0 2022-08-08
|
||||||
|
|
@ -199,6 +199,15 @@ Type TSExcelFile = Class
|
||||||
return array(err, value);
|
return array(err, value);
|
||||||
End;
|
End;
|
||||||
|
|
||||||
|
///获取单元格数据类型
|
||||||
|
///sheet: string,工作表名称
|
||||||
|
///axis: string,单元格坐标,如: "A6"
|
||||||
|
///返回: type:string
|
||||||
|
Function GetCellValueType(sheet, axis);
|
||||||
|
Begin
|
||||||
|
return workbook_.GetCellValueType(class(TSXml).CurCodePageToUtf8(sheet), axis);
|
||||||
|
End;
|
||||||
|
|
||||||
///设置单元格的值
|
///设置单元格的值
|
||||||
///sheet: string,工作表名称
|
///sheet: string,工作表名称
|
||||||
///axis: string,单元格坐标,如: "A6"
|
///axis: string,单元格坐标,如: "A6"
|
||||||
|
|
@ -442,6 +451,19 @@ Type TSExcelFile = Class
|
||||||
if ifObj(o) then o.AddComment(axis, Author, comment);
|
if ifObj(o) then o.AddComment(axis, Author, comment);
|
||||||
End;
|
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,工作表名称
|
///sheet: string,工作表名称
|
||||||
///range:string,图表所处矩形区域,"A5:F10"
|
///range:string,图表所处矩形区域,"A5:F10"
|
||||||
|
|
@ -531,6 +553,14 @@ Type TSExcelFile = Class
|
||||||
return styleObj.GetStyleId(style);
|
return styleObj.GetStyleId(style);
|
||||||
End;
|
End;
|
||||||
|
|
||||||
|
///获取样式对象
|
||||||
|
///返回: TStyle对象
|
||||||
|
Function GetStyle(styleid);
|
||||||
|
Begin
|
||||||
|
styleObj := new xlsxStyles('', self);
|
||||||
|
return styleObj.GetStyle(styleid);
|
||||||
|
End;
|
||||||
|
|
||||||
///设置单元格样式
|
///设置单元格样式
|
||||||
///sheet: string,工作表名称
|
///sheet: string,工作表名称
|
||||||
///topLeft: string,左上角坐标
|
///topLeft: string,左上角坐标
|
||||||
|
|
@ -896,6 +926,48 @@ Type TSExcelFile = Class
|
||||||
return workbook_.GetCalcOptions();
|
return workbook_.GetCalcOptions();
|
||||||
End;
|
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();
|
Function WorkBook();
|
||||||
Begin
|
Begin
|
||||||
return workbook_;
|
return workbook_;
|
||||||
|
|
@ -948,4 +1020,3 @@ private
|
||||||
workbook_; //WorkBook对象
|
workbook_; //WorkBook对象
|
||||||
objMgr_; //各种对象缓存、管理
|
objMgr_; //各种对象缓存、管理
|
||||||
End;
|
End;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -276,14 +276,8 @@ Type TTableContent = class
|
||||||
z := docx_.Zip();
|
z := docx_.Zip();
|
||||||
xml := z.Get('word/' + name);
|
xml := z.Get('word/' + name);
|
||||||
if not ifObj(xml) then Begin
|
if not ifObj(xml) then Begin
|
||||||
path := docx_.GetPath();
|
xmlData := TOfficeTemplate(name);
|
||||||
if path[1] = '/' then Begin
|
if not ifString(xmlData) then
|
||||||
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 ;
|
return ;
|
||||||
z.Add('word/' + name, xmlData);
|
z.Add('word/' + name, xmlData);
|
||||||
rels := 'word/_rels/document.xml.rels';
|
rels := 'word/_rels/document.xml.rels';
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,7 @@ xmlns:v="urn:schemas-microsoft-com:vml">
|
||||||
authors_[ author ] := i ++;
|
authors_[ author ] := i ++;
|
||||||
node := node.NextElement();
|
node := node.NextElement();
|
||||||
End;
|
End;
|
||||||
|
initCommentObjs();
|
||||||
//println('sheet={},commentfile={},vmlfile={}',sheet, commentXmlFile_, drawingVML_);
|
//println('sheet={},commentfile={},vmlfile={}',sheet, commentXmlFile_, drawingVML_);
|
||||||
End;
|
End;
|
||||||
|
|
||||||
|
|
@ -95,12 +96,13 @@ xmlns:v="urn:schemas-microsoft-com:vml">
|
||||||
commentObj.Font.Bold := nil;
|
commentObj.Font.Bold := nil;
|
||||||
commentObj.Space := 'preserve';
|
commentObj.Space := 'preserve';
|
||||||
domData := comments.Marshal();
|
domData := comments.Marshal();
|
||||||
node := getComment(cell);
|
node := commentObjs_[cell];
|
||||||
if ifObj(node) then
|
if ifObj(node) then
|
||||||
node.DeleteChildren();
|
node.DeleteChildren();
|
||||||
else
|
else
|
||||||
node := commentXmlFile_.FirstChildElement('comments').FirstChildElement('commentList').InsertEndChild('element', 'comment');
|
node := commentXmlFile_.FirstChildElement('comments').FirstChildElement('commentList').InsertEndChild('element', 'comment');
|
||||||
node.UnMarshal(domData);
|
node.UnMarshal(domData);
|
||||||
|
commentObjs_[cell] := node;
|
||||||
//commentXmlFile_.print;
|
//commentXmlFile_.print;
|
||||||
innerxml := '<v:shape id="_x0000_s1025" o:spt="202" type="#_x0000_t202" style="position:absolute;left:0pt;top:0pt;margin-left:59.85pt;margin-top:1.5pt;height:60pt;width:97.5pt;visibility:hidden;" fillcolor="#FFFFE1" filled="t" stroked="t" o:insetmode="auto" coordsize="21600,21600">
|
innerxml := '<v:shape id="_x0000_s1025" o:spt="202" type="#_x0000_t202" style="position:absolute;left:0pt;top:0pt;margin-left:59.85pt;margin-top:1.5pt;height:60pt;width:97.5pt;visibility:hidden;" fillcolor="#FFFFE1" filled="t" stroked="t" o:insetmode="auto" coordsize="21600,21600">
|
||||||
<v:path/>
|
<v:path/>
|
||||||
|
|
@ -126,14 +128,41 @@ xmlns:v="urn:schemas-microsoft-com:vml">
|
||||||
clientData.Row := row - 1;
|
clientData.Row := row - 1;
|
||||||
ClientData.Column := col - 1;
|
ClientData.Column := col - 1;
|
||||||
node.UnMarshal(clientData.Marshal());
|
node.UnMarshal(clientData.Marshal());
|
||||||
commentObjs_[ length(commentObjs_) ] := array(cell, node);
|
|
||||||
//xmlObj.Print;
|
//xmlObj.Print;
|
||||||
End;
|
End;
|
||||||
End;
|
End;
|
||||||
return 'ok';
|
return 'ok';
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Function getComment(cell);
|
Function GetComment(cell);
|
||||||
|
Begin
|
||||||
|
o := commentObjs_[cell];
|
||||||
|
if not ifObj(o) then return array('', '');
|
||||||
|
r_node := o.FirstChildElement('text').FirstChildElement('r');
|
||||||
|
author := r_node.FirstChildElement('t').GetText();
|
||||||
|
if length(author) > 1 then author := author[:length(author)-1];
|
||||||
|
r_node := r_node.NextElement();
|
||||||
|
comment := '';
|
||||||
|
while ifObj(r_node) do
|
||||||
|
begin
|
||||||
|
comment += r_node.FirstChildElement('t').GetText();
|
||||||
|
r_node := r_node.NextElement();
|
||||||
|
end
|
||||||
|
if length(comment) > 1 then comment := comment[2:];
|
||||||
|
return array(author, comment);
|
||||||
|
End;
|
||||||
|
|
||||||
|
Function RemoveComment(cell);
|
||||||
|
Begin
|
||||||
|
node := commentObjs_(cell);
|
||||||
|
if ifObj(node) then
|
||||||
|
commentXmlFile_.FirstChildElement('comments').DeleteChild(node);
|
||||||
|
return array(0, 'ok');
|
||||||
|
End;
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
Function initCommentObjs();
|
||||||
Begin
|
Begin
|
||||||
if not ifarray(commentObjs_) then Begin
|
if not ifarray(commentObjs_) then Begin
|
||||||
commentObjs_ := array();
|
commentObjs_ := array();
|
||||||
|
|
@ -143,21 +172,12 @@ xmlns:v="urn:schemas-microsoft-com:vml">
|
||||||
node := node.FirstChildElement('comment');
|
node := node.FirstChildElement('comment');
|
||||||
while ifObj(node) do Begin
|
while ifObj(node) do Begin
|
||||||
ref := node.GetAttribute('ref');
|
ref := node.GetAttribute('ref');
|
||||||
commentObjs_[index++] := array(ref, node);
|
commentObjs_[ref] := node;
|
||||||
node := node.NextElement();
|
node := node.NextElement();
|
||||||
End;
|
End;
|
||||||
End;
|
End;
|
||||||
return vselect [1] from commentObjs_ where [0] = cell end;
|
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Function RemoveComment(cell);
|
|
||||||
Begin
|
|
||||||
node := getComment(cell);
|
|
||||||
if ifObj(node) then
|
|
||||||
commentXmlFile_.FirstChildElement('comments').DeleteChild(node);
|
|
||||||
return array(0, 'ok');
|
|
||||||
End;
|
|
||||||
private
|
|
||||||
authors_;
|
authors_;
|
||||||
commentId_;
|
commentId_;
|
||||||
commentFileName_:string;//'../comments/comment1.xml'
|
commentFileName_:string;//'../comments/comment1.xml'
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,38 @@ Type xlsxStyles = Class
|
||||||
node.InsertEndChild(xf.Marshal());
|
node.InsertEndChild(xf.Marshal());
|
||||||
node.SetAttribute('count', strtoint(count) + 1);
|
node.SetAttribute('count', strtoint(count) + 1);
|
||||||
return count;
|
return count;
|
||||||
End
|
End;
|
||||||
|
|
||||||
|
Function GetStyle(styleId);
|
||||||
|
Begin
|
||||||
|
if styleId = '' then return nil;
|
||||||
|
style_node := styleXmlFile_.FirstChildElement('styleSheet');
|
||||||
|
cellXfs_node := style_node.FirstChildElement('cellXfs');
|
||||||
|
count := strtoint(cellXfs_node.GetAttribute('count'));
|
||||||
|
Id := strtoint(styleId);
|
||||||
|
if Id < count-1 then return nil;
|
||||||
|
|
||||||
|
xf := getNode(style_node, 'cellXfs', 'xf', Id);
|
||||||
|
attrs := xf.Attributes();
|
||||||
|
numfmt_id := trystrtoint(attrs['numFmtId'], r) ? r-1 : 0;
|
||||||
|
font_id := trystrtoint(attrs['fontId'], r) ? r : 0;
|
||||||
|
border_id := trystrtoint(attrs['borderId'], r) ? r : 0;
|
||||||
|
fill_id := trystrtoint(attrs['fillId'], r) ? r : 0;
|
||||||
|
|
||||||
|
alignment := xf.FirstChildElement('alignment');
|
||||||
|
protection := xf.FirstChildElement('protection');
|
||||||
|
style := TOfficeObj('TStyle');
|
||||||
|
setRootObj(style.NumberFormat, getNode(style_node, 'numFmts', 'numFmt', numfmt_id));
|
||||||
|
setRootObj(style.Font, getNode(style_node, 'fonts', 'font', font_id));
|
||||||
|
setRootObj(style.Border, getNode(style_node, 'borders', 'border', border_id));
|
||||||
|
node := getNode(style_node, 'fills', 'fill', fill_id);
|
||||||
|
setRootObj(style.Fill, node);
|
||||||
|
setFillGradientObj(style.Fill.Gradient, node);
|
||||||
|
style.Alignment.RootObj := ifObj(alignment) ? alignment : nil;
|
||||||
|
style.Protection.RootObj := ifObj(protection) ? protection : nil;
|
||||||
|
setNodeUri(style);
|
||||||
|
return style;
|
||||||
|
End;
|
||||||
|
|
||||||
class Function NewObject(sheetname, file);
|
class Function NewObject(sheetname, file);
|
||||||
Begin
|
Begin
|
||||||
|
|
@ -54,6 +85,70 @@ Type xlsxStyles = Class
|
||||||
End;
|
End;
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
Function setFillGradientObj(obj, node);
|
||||||
|
Begin
|
||||||
|
gradient_node := node.FirstChildElement('gradientFill');
|
||||||
|
if not ifObj(gradient_node) then return;
|
||||||
|
stop_node := gradient_node.FirstChildElement('stop');
|
||||||
|
if ifObj(stop_node) then
|
||||||
|
begin
|
||||||
|
obj.Stop1.RootObj := stop_node;
|
||||||
|
obj.Stop1.NodeUri := '';
|
||||||
|
end
|
||||||
|
stop_node := stop_node.NextElement();
|
||||||
|
if ifObj(stop_node) then
|
||||||
|
begin
|
||||||
|
obj.Stop2.RootObj := stop_node;
|
||||||
|
obj.Stop2.NodeUri := '';
|
||||||
|
end
|
||||||
|
stop_node := stop_node.NextElement();
|
||||||
|
if ifObj(stop_node) then
|
||||||
|
begin
|
||||||
|
obj.Stop3.RootObj := stop_node;
|
||||||
|
obj.Stop3.NodeUri := '';
|
||||||
|
end
|
||||||
|
End;
|
||||||
|
|
||||||
|
Function setRootObj(obj, node);
|
||||||
|
Begin
|
||||||
|
obj.RootObj := node;
|
||||||
|
children := obj.GetChildren();
|
||||||
|
for i:=0 to length(children)-1 do
|
||||||
|
begin
|
||||||
|
val := children[i]['obj'];
|
||||||
|
if ifObj(val) then
|
||||||
|
begin
|
||||||
|
val.NodeUri := children[i]['name'];
|
||||||
|
val.RootObj := node;
|
||||||
|
end
|
||||||
|
end;
|
||||||
|
End;
|
||||||
|
|
||||||
|
Function setNodeUri(obj);
|
||||||
|
Begin
|
||||||
|
obj.NodeUri := '';
|
||||||
|
children := obj.GetChildren();
|
||||||
|
for i:=0 to length(children)-1 do
|
||||||
|
begin
|
||||||
|
val := children[i]['obj'];
|
||||||
|
if ifObj(val) then val.NodeUri := '';
|
||||||
|
end;
|
||||||
|
End;
|
||||||
|
|
||||||
|
Function getNode(rootNode, nodeName, name, count);
|
||||||
|
Begin
|
||||||
|
node := rootNode.FirstChildElement(nodeName);
|
||||||
|
if not ifObj(node) then return nil;
|
||||||
|
node := node.FirstChildElement(name);
|
||||||
|
while count > 0 do
|
||||||
|
begin
|
||||||
|
node := node.NextElement();
|
||||||
|
count--;
|
||||||
|
end
|
||||||
|
return node;
|
||||||
|
End;
|
||||||
|
|
||||||
Function insertNode(rootNode, childName, obj);
|
Function insertNode(rootNode, childName, obj);
|
||||||
Begin
|
Begin
|
||||||
marshal := obj.Marshal();
|
marshal := obj.Marshal();
|
||||||
|
|
|
||||||
|
|
@ -98,6 +98,13 @@ Type xlsxWorkBook = Class
|
||||||
return class(ErrorMessage).Fail();
|
return class(ErrorMessage).Fail();
|
||||||
End;
|
End;
|
||||||
|
|
||||||
|
Function GetCellValueType(sheet, axis);
|
||||||
|
Begin
|
||||||
|
o := GetSheetObj(sheet);
|
||||||
|
if ifObj(o) then return o.GetAttribute(axis, '', 't')[1];
|
||||||
|
return '';
|
||||||
|
End;
|
||||||
|
|
||||||
Function SetCellValue(sheet, axis, val, opt);
|
Function SetCellValue(sheet, axis, val, opt);
|
||||||
Begin
|
Begin
|
||||||
o := GetSheetObj(sheet);
|
o := GetSheetObj(sheet);
|
||||||
|
|
@ -1351,7 +1358,100 @@ Type xlsxWorkBook = Class
|
||||||
margins := TOfficeObj('tmargins');
|
margins := TOfficeObj('tmargins');
|
||||||
margins.RootObj := node;
|
margins.RootObj := node;
|
||||||
return margins;
|
return margins;
|
||||||
|
End;
|
||||||
|
|
||||||
|
Function SetRowOutlineLevel(sheet, row, level);
|
||||||
|
Begin
|
||||||
|
sheet_obj := GetSheetObj(sheet);
|
||||||
|
o := GetSheetObj(sheet);
|
||||||
|
if not sheet_obj.RowIsExists(row) then
|
||||||
|
begin
|
||||||
|
[err, cell] := CoordinatesToCellName(1, row);
|
||||||
|
sheet_obj.SetCellValue(cell, '');
|
||||||
|
end
|
||||||
|
sheet_obj.SetAttribute(row, array("outlineLevel": level));
|
||||||
|
End;
|
||||||
|
|
||||||
|
Function GetRowOutlineLevel(sheet, row);
|
||||||
|
Begin
|
||||||
|
sheet_obj := GetSheetObj(sheet);
|
||||||
|
o := GetSheetObj(sheet);
|
||||||
|
if not sheet_obj.RowIsExists(row) then return 0;
|
||||||
|
[err, level] := sheet_obj.GetAttribute(row, 'outlineLevel');
|
||||||
|
return level = '' ? 0 : strtoint(level);
|
||||||
|
End;
|
||||||
|
|
||||||
|
Function SetColOutlineLevel(sheet, col, level);
|
||||||
|
Begin
|
||||||
|
sheet_xml_file := GetSheetXmlFile(sheet);
|
||||||
|
if not ifObj(sheet_xml_file) then return 'The Sheet is not exist.';
|
||||||
|
work_node := sheet_xml_file.FirstChildElement('worksheet');
|
||||||
|
col_node := work_node.FirstChildElement('cols');
|
||||||
|
prev_node := class(TSXml).GetWorkSheetPrevNode(work_node, 'cols');
|
||||||
|
if not ifObj(col_node) then col_node := work_node.InsertAfterChild(prev_node,'element', 'cols');
|
||||||
|
node := col_node.FirstChildElement('col');
|
||||||
|
while ifObj(node) do
|
||||||
|
Begin
|
||||||
|
min := strtoint(node.GetAttribute('min'));
|
||||||
|
max := strtoint(node.GetAttribute('max'));
|
||||||
|
if col >= min and col <= max then
|
||||||
|
Begin
|
||||||
|
level_val := node.GetAttribute('outlineLevel');
|
||||||
|
if strtoint(level_val) = level then return;
|
||||||
|
else Begin
|
||||||
|
if col = min and col = max then node.SetAttribute('outlineLevel', level);
|
||||||
|
else begin
|
||||||
|
node2 := col_node.InsertAfterChild(node, node.Marshal()[0]);
|
||||||
|
if col = min then
|
||||||
|
begin
|
||||||
|
node.SetAttribute('max', col);
|
||||||
|
node.SetAttribute('outlineLevel', level);
|
||||||
|
node2.SetAttribute('min', col-1);
|
||||||
|
end
|
||||||
|
else if col = max then
|
||||||
|
begin
|
||||||
|
node.SetAttribute('max', col-1);
|
||||||
|
node2.SetAttribute('outlineLevel', level);
|
||||||
|
node2.SetAttribute('min', col);
|
||||||
|
end
|
||||||
|
else begin
|
||||||
|
node3 := col_node.InsertAfterChild(node, node.Marshal()[0]);
|
||||||
|
node.SetAttribute('max', col - 1);
|
||||||
|
node2.SetAttribute('min', col + 1);
|
||||||
|
node3.SetAttribute('min', col);
|
||||||
|
node3.SetAttribute('max', col);
|
||||||
|
node3.SetAttribute('outlineLevel', level);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return 'ok';
|
||||||
End
|
End
|
||||||
|
End
|
||||||
|
node := node.NextElement();
|
||||||
|
End
|
||||||
|
arr := array('type': 'element', 'name': 'col', 'attributes': ('min': col, 'max': col, 'outlineLevel': level, 'customWidth': 1, 'width': 9.06640625));
|
||||||
|
col_node.InsertEndChild(arr);
|
||||||
|
return 'ok';
|
||||||
|
End;
|
||||||
|
|
||||||
|
Function GetColOutlineLevel(sheet, col);
|
||||||
|
Begin
|
||||||
|
sheet_xml_file := GetSheetXmlFile(sheet);
|
||||||
|
if not ifObj(sheet_xml_file) then return "Sheet error";
|
||||||
|
work_node := sheet_xml_file.FirstChildElement('worksheet');
|
||||||
|
col_node := work_node.FirstChildElement('cols');
|
||||||
|
if not ifObj(col_node) then return 0;
|
||||||
|
node := col_node.FirstChildElement('col');
|
||||||
|
while ifObj(node) do
|
||||||
|
begin
|
||||||
|
min := strtoint(node.GetAttribute('min'));
|
||||||
|
max := strtoint(node.GetAttribute('max'));
|
||||||
|
val := node.GetAttribute('outlineLevel');
|
||||||
|
if col >= min and col <= max then return val = '' ? 0 : strtoint(val);
|
||||||
|
node := node.NextElement();
|
||||||
|
end
|
||||||
|
return 0;
|
||||||
|
End;
|
||||||
|
|
||||||
|
|
||||||
private
|
private
|
||||||
Function generateRow(c1, c2, r);
|
Function generateRow(c1, c2, r);
|
||||||
|
|
|
||||||
13
更新日志.md
13
更新日志.md
|
|
@ -1,5 +1,18 @@
|
||||||
# 更新日志
|
# 更新日志
|
||||||
|
|
||||||
|
## 2023-3-6
|
||||||
|
|
||||||
|
### V1.2.2
|
||||||
|
|
||||||
|
#### excel
|
||||||
|
|
||||||
|
1. 修复`InsertRow`之后原有单元格合并错误问题
|
||||||
|
2. 新增`GetCellValueType`
|
||||||
|
3. 新增`GetComment`
|
||||||
|
4. 新增`GetStyle`,获取的样式修改可通过`TStyle::Apply()`方法重新写入样式
|
||||||
|
5. 新增`SetRowOutlineLevel`、`GetRowOutlineLevel`
|
||||||
|
6. 新增`SetColOutlineLevel`、`GetColOutlineLevel`
|
||||||
|
|
||||||
## 2023-2-24
|
## 2023-2-24
|
||||||
|
|
||||||
### V1.2.1
|
### V1.2.1
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue