786 lines
33 KiB
Plaintext
786 lines
33 KiB
Plaintext
path := ExtractFileDir(ExtractFileDir(PluginPath()));
|
||
{$IFNDEF Win32}
|
||
path := path + '\\funcext\\TSOffice\\TSExcelFile.tsf';
|
||
{$ELSE}
|
||
path := path + '/funcext/TSOffice/TSExcelFile.tsf';
|
||
{$ENDIF}
|
||
funcs := LoadClassInfo(path);
|
||
|
||
testing := 1;
|
||
file := new TSExcelFile();
|
||
[err, errinfo] := file.NewFile();
|
||
if err then
|
||
return PrintError("NewFile", err, errinfo);
|
||
PrintSuccess("NewFile", testing++);
|
||
|
||
file.SetSheetName('Sheet1', 'ExcelFile');
|
||
PrintSuccess("SetSheetName", testing++);
|
||
|
||
file.NewSheet("Functions");
|
||
PrintSuccess("NewSheet", testing++);
|
||
|
||
file.SetDefaultSheet('ExcelFile');
|
||
|
||
richtext := TOfficeObj('TRichText');
|
||
txt1 := richtext.AddText('TSExcelFile类 ');
|
||
txt1.Font.Size := 35;
|
||
txt1.Font.Color := "FF0000";
|
||
txt1.Font.Bold := 1;
|
||
txt1.Font.Name := "华文彩云";
|
||
txt2 := richtext.AddText('帮助文档');
|
||
txt2.Font.Size := 30;
|
||
txt2.Font.Name := "微软雅黑";
|
||
txt2.Font.Bold := 1;
|
||
txt2.Font.Italic := 1;
|
||
txt2.Font.Color := "FFC0CB";
|
||
|
||
file.SetCellRichText('ExcelFile', 'A1', richtext);
|
||
PrintSuccess("SetCellRichText", testing++);
|
||
[err, richText] := file.GetCellRichText('ExcelFile', 'A1');
|
||
if err then
|
||
return PrintError("GetCellRichText", err, errinfo);
|
||
PrintSuccess("GetCellRichText", testing++);
|
||
|
||
file.MergeCell('ExcelFile', 'A1', 'C1');
|
||
PrintSuccess("MergeCell", testing++);
|
||
|
||
|
||
style := TOfficeObj('TStyle');
|
||
style.Border.Left.LineStyle := "double";
|
||
style.Border.Left.Color := "FF0000";
|
||
style.Border.Right.LineStyle := "double";
|
||
style.Border.Right.Color := "FF0000";
|
||
style.Border.Bottom.LineStyle := "double";
|
||
style.Border.Bottom.Color := "FF0000";
|
||
style.Border.Top.LineStyle := "double";
|
||
style.Border.Top.Color := "FF0000";
|
||
style.Alignment.Horizontal := "center";
|
||
style.Alignment.Vertical := "center";
|
||
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++);
|
||
|
||
file.SetCellStyle("ExcelFile", 'A1', 'C1', styleId);
|
||
|
||
file.SetCellValue("ExcelFile", "A3", "索引");
|
||
file.SetCellValue("ExcelFile", "B3", "函数名称");
|
||
file.SetCellValue("ExcelFile", "C3", "功能");
|
||
file.SetColWidth("ExcelFile", "A", "A", 6);
|
||
file.SetColWidth("ExcelFile", "B", "B", 55);
|
||
file.SetColWidth("ExcelFile", "C", "C", 100);
|
||
file.SetCellStyle("ExcelFile", "A3", "C3", styleId);
|
||
|
||
|
||
style2 := TOfficeObj("TStyle");
|
||
style2.Font.Color := "A020F0";
|
||
style2.Font.Bold := true;
|
||
style2.Font.Size := 12;
|
||
style2.Font.Name := "Microsoft YaHei";
|
||
style2.Fill.Pattern.PatternType := "solid";
|
||
style2.Fill.Pattern.ForegroundColor := "EFEFEF";
|
||
style2.Alignment.WrapText := true;
|
||
styleId2 := file.NewStyle(style2);
|
||
|
||
style3 := TOfficeObj("TStyle");
|
||
style3.Font.Color := "1F7F3B";
|
||
style3.Font.Size := 9;
|
||
style3.Font.Name := "Microsoft YaHei";
|
||
style3.Fill.Pattern.PatternType := "solid";
|
||
style3.Fill.Pattern.ForegroundColor := "FFFAFA";
|
||
style3.Alignment.WrapText := true;
|
||
styleId3 := file.NewStyle(style3);
|
||
|
||
style4 := TOfficeObj("TStyle");
|
||
style4.Font.Color := "A020F0";
|
||
style4.Font.UnderLine := "single";
|
||
styleId4 := file.NewStyle(style4);
|
||
|
||
hash := AddTOfficeObj(file);
|
||
|
||
row := 1;
|
||
for i:=0 to length(funcs)-1 do
|
||
Begin
|
||
[err0, cell0] := file.CoordinatesToCellName(1, i+4);
|
||
[err1, cell1] := file.CoordinatesToCellName(2, i+4);
|
||
[err2, cell2] := file.CoordinatesToCellName(3, i+4);
|
||
file.SetCellValue("ExcelFile", cell0, i+1);
|
||
file.SetCellValue("ExcelFile", cell1, funcs[i]['funcname']);
|
||
file.SetCellValue("ExcelFile", cell2, funcs[i]['name']);
|
||
|
||
str := funcs[i]['name'] + "\nFunction " + funcs[i]['funcname'] + funcs[i]['comment'];
|
||
arr := str2array(str, "\n");
|
||
[err, c1] := file.CoordinatesToCellName(1, row);
|
||
[err, c2] := file.CoordinatesToCellName(1, row + length(arr) - 1);
|
||
file.SetCellStyle("Functions", c1, c1, styleId2);
|
||
file.SetCellStyle("Functions", c1, c2, styleId3);
|
||
|
||
for j:=0 to length(arr)-1 do
|
||
Begin
|
||
[err, c] := file.CoordinatesToCellName(1, row++);
|
||
file.SetCellValue("Functions", c, arr[j]);
|
||
End
|
||
row++;
|
||
|
||
hyperlink := TOfficeObj('THyperLink');
|
||
hyperlink.LinkType := "location";
|
||
hyperlink.LinkUrl := "Functions!" $ c1;
|
||
|
||
file.SetCellHyperLink("ExcelFile", cell1, hyperlink);
|
||
file.SetCellStyle("ExcelFile", cell1, cell1, styleId4);
|
||
|
||
End
|
||
|
||
file.SetColWidth('Functions', 'A', 'A', 120);
|
||
PrintSuccess('SetColWidth', testing++);
|
||
|
||
saveName := utf8toansi("ExcelFile使用帮助.xlsx");
|
||
[err, errinfo] := file.SaveAs('', saveName);
|
||
if err then
|
||
return PrintError("SaveAs", err, errinfo);
|
||
PrintSuccess("SaveAs", testing++);
|
||
|
||
|
||
|
||
// ============================================================
|
||
Function PrintError(msg, errno, errinfo);
|
||
Begin
|
||
return println("{} : errorno = {}, errorinfo = {}!", msg, errno, errinfo);
|
||
End
|
||
|
||
Function PrintSuccess(msg, time);
|
||
Begin
|
||
println("Test {} [{} success]", time, msg);
|
||
End
|
||
|
||
Function LoadClassInfo(f);
|
||
Begin
|
||
t := array();
|
||
[err,fh] := io_open(f);
|
||
if err then return t;
|
||
[err, data] := io_read(fh);
|
||
io_close(fh);
|
||
if err then return t;
|
||
|
||
lines := str2array(string(data), "\n");
|
||
for i:=0 to length(lines)-1 do begin
|
||
line := lines[i];
|
||
if AnsiContainsText(line, 'private') then break;
|
||
str := " End;";
|
||
if leftstr(line, length(str)) = str then Begin
|
||
//if funcname <> "" and leftstr(funcname,7) <> "Create(" and leftstr(funcname,8) <> "Destory(" then Begin
|
||
if flag and funcname <> "" then Begin
|
||
n := length(t);
|
||
t[n]['funcname'] := funcname;
|
||
t[n]['comment'] := comment;
|
||
t[n]['name'] := name;
|
||
End;
|
||
funcname := "";
|
||
comment := "";
|
||
name := "";
|
||
begF := 0;
|
||
endF := 1;
|
||
flag := 0;
|
||
continue;
|
||
End;
|
||
func := " Function ";
|
||
if leftstr(line, length(func)) = func then Begin
|
||
funcname := rightstr(line, length(line)-length(func));
|
||
begF := 1;
|
||
continue;
|
||
End;
|
||
if endF=0 or begF then continue;
|
||
if ParseRegExpr("\/\/\/(.*)$",line,"",result,MPos,Mlen) and length(result) then Begin
|
||
flag := 1;
|
||
str := result[0][1];
|
||
if name="" then begin
|
||
name := str;
|
||
continue;
|
||
end;
|
||
comment := comment + "\n " + str;
|
||
End;
|
||
End;
|
||
return t;
|
||
End;
|
||
|
||
Function AddTOfficeObj(excel);
|
||
Begin
|
||
hash := array();
|
||
sheet_name := "TOfficeObj说明";
|
||
excel.NewSheet(sheet_name);
|
||
excel.SetColWidth(sheet_name, 'A', 'A', 32);
|
||
excel.SetColWidth(sheet_name, 'B', 'B', 25);
|
||
excel.SetColWidth(sheet_name, 'C', 'C', 30);
|
||
excel.SetColWidth(sheet_name, 'D', 'D', 35);
|
||
|
||
style := TOfficeObj('TStyle');
|
||
style.Alignment.Horizontal := "center";
|
||
style.Alignment.WrapText := True;
|
||
style.Font.Name := "Microsoft YaHei";
|
||
style.Font.Color := "E10D4F";
|
||
style.Font.Size := 14;
|
||
style.Font.Bold := True;
|
||
style.Font.UnderLine := 'singleAccounting';
|
||
style.Fill.Gradient.Type := 'path';
|
||
style.Fill.Gradient.Left := 0.5;
|
||
style.Fill.Gradient.Left := 0.5;
|
||
style.Fill.Gradient.Left := 0.5;
|
||
style.Fill.Gradient.Left := 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');
|
||
style.Font.Name := "Microsoft YaHei";
|
||
style.Font.ThemeColor := "8";
|
||
style.Font.Size := 10;
|
||
style.Font.Bold := True;
|
||
style.Alignment.WrapText := True;
|
||
style.Fill.Pattern.PatternType := 'lightGrid';
|
||
style.Fill.Pattern.ForegroundThemeColor := 4;
|
||
style.Fill.Pattern.ForegroundThemeColorTint := 0.8;
|
||
style.Fill.Pattern.BackgroundThemeColor := 9;
|
||
style.Fill.Pattern.BackgroundThemeColorTint := 0.8;
|
||
styleid2 := excel.NewStyle(style);
|
||
|
||
style := TOfficeObj('TStyle');
|
||
style.Font.Name := "Consolas";
|
||
style.Font.ThemeColor := "1";
|
||
style.Font.Size := 10;
|
||
style.Alignment.WrapText := True;
|
||
style.Alignment.Horizontal := 'left';
|
||
style.Alignment.Vertical := 'center';
|
||
style.Fill.Pattern.PatternType := "solid";
|
||
style.Fill.Pattern.ForegroundThemeColor := 6;
|
||
style.Fill.Pattern.ForegroundThemeColorTint := 0.8;
|
||
style.Fill.Pattern.BackgroundThemeColor := 0;
|
||
styleid3 := excel.NewStyle(style);
|
||
|
||
style := TOfficeObj("TStyle");
|
||
style.Font.Color := "";
|
||
style.Font.Size := 9;
|
||
style.Font.Name := "Microsoft YaHei";
|
||
style.Fill.Pattern.PatternType := "solid";
|
||
style.Fill.Pattern.ForegroundColor := "FFFAFA";
|
||
style.Alignment.WrapText := true;
|
||
style.Border.Left.LineStyle := "dotted";
|
||
style.Border.Right.LineStyle := "dotted";
|
||
style.Border.Top.LineStyle := "dotted";
|
||
style.Border.Bottom.LineStyle := "dotted";
|
||
styleId4 := excel.NewStyle(style);
|
||
|
||
style := TOfficeObj("TStyle");
|
||
style.Font.Color := "000000";
|
||
style.Font.Size := 12;
|
||
style.Font.Name := "Consolas";
|
||
style.Font.Bold := True;
|
||
style.Alignment.WrapText := true;
|
||
style.Alignment.Vertical := "top";
|
||
styleId5 := excel.NewStyle(style);
|
||
style.Font.Bold := False;
|
||
style.Font.Size := 11;
|
||
style.Font.Color := "757575";
|
||
styleId6 := excel.NewStyle(style);
|
||
|
||
style := TOfficeObj("TStyle");
|
||
style.Font.Size := 11;
|
||
style.Font.Name := "Microsoft YaHei";
|
||
style.Font.Color := "000000";
|
||
style.Alignment.WrapText := True;
|
||
style.Alignment.Vertical := "top";
|
||
styleId7 := excel.NewStyle(style);
|
||
|
||
style := TOfficeObj("TStyle");
|
||
style.Font.Size := 11;
|
||
style.Font.Name := "幼圆";
|
||
style.Font.Color := "502447";
|
||
style.Font.Bold := True;
|
||
style.Fill.Pattern.PatternType := "solid";
|
||
style.Fill.Pattern.ForegroundThemeColor := 9;
|
||
style.Fill.Pattern.ForegroundThemeColorTint := 0.6;
|
||
style.Fill.Pattern.BackgroundThemeColor := 0;
|
||
styleId8 := excel.NewStyle(style);
|
||
|
||
col := 1;
|
||
row := 1;
|
||
merge_span := 3;
|
||
obj_info := getObjInfo();
|
||
for i:=0 to length(obj_info)-1 do
|
||
begin
|
||
name := obj_info[i]['ObjName'];
|
||
[err, cell_1] := excel.CoordinatesToCellName(col, row);
|
||
[err, cell_2] := excel.CoordinatesToCellName(col+merge_span, row);
|
||
hash[name] := cell_1;
|
||
excel.SetCellValue(sheet_name, cell_1, name);
|
||
excel.MergeCell(sheet_name, cell_1, cell_2);
|
||
excel.SetCellStyle(sheet_name, cell_1, cell_2, styleid1);
|
||
row++;
|
||
|
||
desc_arr := obj_info[i]['Desc'];
|
||
for j:=0 to length(desc_arr)-1 do
|
||
begin
|
||
[err, cell1] := excel.CoordinatesToCellName(col, row);
|
||
[err, cell2] := excel.CoordinatesToCellName(col+merge_span, row);
|
||
excel.MergeCell(sheet_name, cell1, cell2);
|
||
[err, cell_3] := excel.CoordinatesToCellName(col, row);
|
||
height := length(desc_arr[j]) < 120 ? 15 : length(desc_arr[j])/120*15;
|
||
excel.SetRowHeight(sheet_name, row, height);
|
||
excel.SetCellValue(sheet_name, cell_3, desc_arr[j]);
|
||
row++;
|
||
end
|
||
[err, cell3] := excel.CoordinatesToCellName(col, row - 1);
|
||
excel.SetCellStyle(sheet_name, cell1, cell3, styleid2);
|
||
|
||
count := 1;
|
||
attr_arr := obj_info[i]['AttrInfo'];
|
||
if not istable(attr_arr) then attr_arr := array();
|
||
for k:=0 to length(attr_arr)-1 do
|
||
begin
|
||
if k = 0 then
|
||
begin
|
||
[err, cell1] := excel.CoordinatesToCellName(col, row);
|
||
[err, cell2] := excel.CoordinatesToCellName(col+3, row);
|
||
excel.SetSheetRow(sheet_name, cell1, array("属性", "类型", "说明", "取值"));
|
||
excel.SetCellStyle(sheet_name, cell1, cell2, styleId8);
|
||
row++;
|
||
end
|
||
if attr_arr[k]['attrName'] then
|
||
begin
|
||
insert_col := col;
|
||
[err, cell_2] := excel.CoordinatesToCellName(insert_col, row);
|
||
excel.SetCellValue(sheet_name, cell_2, attr_arr[k]['attrName']);
|
||
excel.SetCellStyle(sheet_name, cell_2, cell_2, styleid5);
|
||
insert_col++;
|
||
|
||
[err, cell_2] := excel.CoordinatesToCellName(insert_col, row);
|
||
excel.SetCellValue(sheet_name, cell_2, attr_arr[k]['type']);
|
||
excel.SetCellStyle(sheet_name, cell_2, cell_2, styleId6);
|
||
insert_col++;
|
||
|
||
[err, cell_2] := excel.CoordinatesToCellName(insert_col, row);
|
||
desc_str := attr_arr[k]['desc'];
|
||
if desc_str and ParseRegExpr("{(.*?)}", desc_str, "", result, mpos, mlen) then
|
||
begin
|
||
richText := TOfficeObj('TRichText');
|
||
position := 1;
|
||
for index := 0 to length(result)-1 do
|
||
begin
|
||
s1 := "";
|
||
endposition := mpos[index][0];
|
||
if endposition > 1 then
|
||
begin
|
||
s1 := desc_str[position: endposition-1];
|
||
t1 := richText.AddText(s1);
|
||
end
|
||
s2 := result[index][1];
|
||
position += length(s1) + mlen[index][0];
|
||
t2 := richText.AddText(s2);
|
||
t2.Font.Bold := True;
|
||
end
|
||
if position - 1 < length(desc_str) then t3 := richText.AddText(desc_str[position:]);
|
||
excel.SetCellRichText(sheet_name, cell_2, richText);
|
||
excel.SetCellStyle(sheet_name, cell_2, cell_2, styleId7);
|
||
end
|
||
insert_col++;
|
||
|
||
value_arr := attr_arr[k]['value'];
|
||
if istable(value_arr) then
|
||
begin
|
||
value_str := array2str(value_arr, "\r\n");
|
||
[err, cell_2] := excel.CoordinatesToCellName(insert_col, row);
|
||
excel.SetCellValue(sheet_name, cell_2, value_str);
|
||
excel.SetCellStyle(sheet_name, cell_2, cell_2, styleId4);
|
||
end
|
||
end
|
||
else if attr_arr[k]['desc'] then
|
||
begin
|
||
[err, cell1] := excel.CoordinatesToCellName(col, row);
|
||
[err, cell2] := excel.CoordinatesToCellName(col+merge_span, row);
|
||
excel.MergeCell(sheet_name, cell1, cell2);
|
||
desc_str := attr_arr[k]['desc'];
|
||
if ParseRegExpr("{(.*?)}", desc_str, "", result, mpos, mlen) then
|
||
begin
|
||
richText := TOfficeObj('TRichText');
|
||
position := 1;
|
||
for index := 0 to length(result)-1 do
|
||
begin
|
||
s1 := "";
|
||
endposition := mpos[index][0];
|
||
if endposition > 1 then
|
||
begin
|
||
s1 := desc_str[position: endposition-1];
|
||
t1 := richText.AddText(s1);
|
||
end
|
||
s2 := result[index][1];
|
||
position += length(s1) + mlen[index][0];
|
||
t2 := richText.AddText(s2);
|
||
t2.Font.Bold := True;
|
||
end
|
||
if position - 1 <= length(desc_str) then t3 := richText.AddText(desc_str[position:]);
|
||
excel.SetCellRichText(sheet_name, cell1, richText);
|
||
end
|
||
end
|
||
|
||
row++;
|
||
end
|
||
|
||
demo_str := trim(obj_info[i]['Demo']);
|
||
if demo_str <> '' then
|
||
begin
|
||
demo_arr := str2array(demo_str);
|
||
for demo_index := 0 to length(demo_arr)-2 do
|
||
begin
|
||
[err, cell_name] := excel.CoordinatesToCellName(col, row);
|
||
[err, cell2] := excel.CoordinatesToCellName(col, row);
|
||
[err, cell_name2] := excel.CoordinatesToCellName(col + merge_span, row);
|
||
excel.SetCellValue(sheet_name, cell_name, demo_arr[demo_index]);
|
||
excel.MergeCell(sheet_name, cell_name, cell_name2);
|
||
excel.SetCellStyle(sheet_name, cell_name, cell2, styleid3);
|
||
row++;
|
||
end
|
||
end
|
||
|
||
row ++;
|
||
end
|
||
|
||
return hash;
|
||
|
||
End
|
||
|
||
Function getObjInfo();
|
||
Begin
|
||
richTextDemo := "
|
||
richText := TOfficeObj('TRichText');
|
||
text1 := richText.AddText('Hello');
|
||
text1.Font.Size := 35;
|
||
text1.Font.Color := 'FF0000';
|
||
text2 := richText.AddText('World');
|
||
text2.Font.Size := 35;
|
||
text2.Font.Bold := true;
|
||
";
|
||
styleDemo := "
|
||
style := TOfficeObj('TStyle');
|
||
style.Font.Color := 'A020F0';
|
||
style.Font.Size := 22;
|
||
style.Font.Name := '黑体';
|
||
style.Font.Bold := True;
|
||
style.Font.Charset := '134';
|
||
style.Font.Script := 'subscript';
|
||
style.Font.Underline := 'double';
|
||
style.Font.Strikethrough := True;
|
||
style.Font.Italic := True;
|
||
style.Alignment.Horizontal := 'center';
|
||
style.Alignment.Vertical := 'justify';
|
||
style.Alignment.WrapText := True;
|
||
style.Alignment.ReadingOrder := 2;
|
||
style.Border.Left.LineStyle := 'thin';
|
||
style.Border.Left.Color := 'A020F0';
|
||
style.Border.Right.LineStyle := 'thin';
|
||
style.Border.Right.Color := 'FF0000';
|
||
style.Border.Bottom.LineStyle := 'mediumDashed';
|
||
style.Border.Bottom.Color := 'FF0000';
|
||
style.Border.Top.LineStyle := 'mediumDashed';
|
||
style.Border.Top.Color := 'FF0000';
|
||
style.Border.DiagonalDown := True;
|
||
style.Border.DiagonalUp := True;
|
||
style.Border.Diagonal.LineStyle := 'double';
|
||
style.Border.Diagonal.Color := 'A020F0';
|
||
style.NumberFormat.FormatCode := '#,##0.000_ ';
|
||
//style.Fill.Pattern.PatternType := 'solid';
|
||
//style.Fill.Pattern.ForegroundColor := 'FF6699FF';
|
||
//style.Fill.Pattern.BackgroundColor := 'FFFF0000';
|
||
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;
|
||
";
|
||
|
||
return array(
|
||
('ObjName': 'TRichText',
|
||
'Desc': ('富文本在使用时需要先用AddText方法添加一段文本,再对本段文本的字体样式(TFont)进行设置'),
|
||
'Demo': richTextDemo
|
||
),
|
||
('ObjName': 'TStyle',
|
||
'Desc': ('TStyle有以下属性: '),
|
||
'AttrInfo': (
|
||
('attrName': 'NumberFormat', 'type': 'class - TNumFmts', 'desc': '数字样式', 'value': array()),
|
||
('attrName': 'Alignment', 'type': 'class - TAlignmenth', 'desc': '对齐样式', 'value': array()),
|
||
('attrName': 'Font', 'type': 'class - TFont', 'desc': '字体样式', 'value': array()),
|
||
('attrName': 'Border', 'type': 'class - TBorder', 'desc': '边框样式', 'value': array()),
|
||
('attrName': 'Fill', 'type': 'class - TFills', 'desc': '填充样式', 'value': array()),
|
||
('attrName': 'Protection', 'type': 'class - TProtection', 'desc': '保护样式', 'value': array()),
|
||
),
|
||
'Demo': styleDemo,
|
||
),
|
||
('ObjName': 'TNumFmts',
|
||
'Desc': ('TNumFmts有以下属性: '),
|
||
'AttrInfo': (
|
||
('attrName': 'FormatCode', 'type': 'string', 'desc': '', 'value': array()),
|
||
),
|
||
'Demo': '',
|
||
),
|
||
('ObjName': 'TAlignment',
|
||
'Desc': ('TAlignment有以下属性: '),
|
||
'AttrInfo': (
|
||
('attrName': 'Horizontal', 'type': 'string', 'desc': '水平对齐', 'value': array('nil(默认): 靠右', '"center": 居中', '"left": 靠左', '"fill": 填充', '"justify": 两端对齐', '"distributed": 两端对齐', '"centerContinuous": 跨列居中')),
|
||
('attrName': 'Vertical', 'type': 'string', 'desc': '垂直对齐', 'value': array('nil(默认): 靠下', '"center": 居中', '"top": 靠上', '"justify": 两端对齐', 'distributed: 分散对齐')),
|
||
('attrName': 'WrapText', 'type': 'boolean', 'desc': '是否自动换行,默认FALSE', 'value': array()),
|
||
('attrName': 'ReadingOrder', 'type': 'int', 'desc': '文字方向', 'value': array('nil(默认): 根据内容', '1: 总是从左到右', '2: 总是从右到左')),
|
||
('attrName': 'TextRotation', 'type': 'int', 'desc': '文本方向', 'value': array('[-90:90]')),
|
||
),
|
||
'Demo': '',
|
||
),
|
||
('ObjName': 'TFont',
|
||
'Desc': ('TFont有以下属性: '),
|
||
'AttrInfo': (
|
||
('attrName': 'Name', 'type': 'string', 'desc': '字体名称', 'value': array()),
|
||
('attrName': 'Size', 'type': 'double', 'desc': '字体大小', 'value': array()),
|
||
('attrName': 'Bold', 'type': 'boolean', 'desc': '是否加粗,默认FALSE', 'value': array()),
|
||
('attrName': 'Italic', 'type': 'boolean', 'desc': '是否倾斜,默认FALSE', 'value': array()),
|
||
('attrName': 'Charset', 'type': 'string', 'desc': '字符集', 'value': array()),
|
||
('attrName': 'Strikethrough', 'type': 'boolean', 'desc': '是否启用删除线,默认FALSE', 'value': array()),
|
||
('attrName': 'Script', 'type': 'string', 'desc': '上下标', 'value': array('"subscript": 下标', '"superscript": 上标')),
|
||
('attrName': '', 'type': 'double', 'desc': '{颜色}:{Color}和{ThemeColor}只能设置一种', 'value': array()),
|
||
('attrName': 'Color', 'type': 'string', 'desc': 'RGB颜色,如"A020F0"', 'value': array()),
|
||
('attrName': 'ThemeColor', 'type': 'int', 'desc': '主题颜色', 'value': array()),
|
||
('attrName': 'Underline', 'type': 'string', 'desc': '下划线', 'value': array('"none": 无', '"single": 单下划线', '"double": 双下划线', '"singleAccounting": 会计单下划线', '"doubleAccounting": 会计双下划线')),
|
||
),
|
||
'Demo': '',
|
||
),
|
||
('ObjName': 'TBorders',
|
||
'Desc': ('TBorders有以下属性: '),
|
||
'AttrInfo': (
|
||
('attrName': 'Left', 'type': 'class - TBorder', 'desc': '左边框', 'value': array()),
|
||
('attrName': 'Right', 'type': 'class - TBorder', 'desc': '右边框', 'value': array()),
|
||
('attrName': 'Top', 'type': 'class - TBorder', 'desc': '上边框', 'value': array()),
|
||
('attrName': 'Bottom', 'type': 'class - TBorder', 'desc': '下边框', 'value': array()),
|
||
('attrName': 'DiagonalUp', 'type': 'boolean', 'desc': '左下-右上 对角线', 'value': array()),
|
||
('attrName': 'DiagonalDown', 'type': 'boolean', 'desc': '左上-右下 对角线', 'value': array()),
|
||
('attrName': 'Diagonal', 'type': 'class - TBorder', 'desc': '对角线,设置 {DiagonalUp}或{DiagonalDown}时有效', 'value': array()),
|
||
),
|
||
'Demo': '',
|
||
),
|
||
('ObjName': 'TBorder',
|
||
'Desc': ('TBorder有以下属性: '),
|
||
'AttrInfo': (
|
||
('attrName': 'LineStyle', 'type': 'string', 'desc': '线型', 'value': array('"hair"', '"dotted"', '"dashDotDot"', '"dashDot"', '"dashed"', '"thin"', '"slantDashDot"', '"mediumDashedDotDot"', '"mediumDashedDot"', '"mediumDashed"', '"medium"', '"thick"', '"double"')),
|
||
('attrName': '', 'type': '', 'desc': '{颜色}:{Color}和{ThemeColor}只能设置一个', 'value': array()),
|
||
('attrName': 'Color', 'type': 'string', 'desc': 'RGB颜色', 'value': array()),
|
||
('attrName': 'ThemeColor', 'type': 'int', 'desc': '主题颜色', 'value': array()),
|
||
),
|
||
'Demo': '',
|
||
),
|
||
('ObjName': 'TFills',
|
||
'Desc': ('TFills有以下属性: '),
|
||
'AttrInfo': (
|
||
('attrName': '', 'type': '', 'desc': '填充方式{Pattern}和{Gradient}只能设置一种', 'value': array()),
|
||
('attrName': 'Pattern', 'type': 'class - TPattern', 'desc': '图案填充', 'value': array()),
|
||
('attrName': 'Gradient', 'type': 'class - TGradient', 'desc': '颜色渐变填充', 'value': array()),
|
||
),
|
||
'Demo': '',
|
||
),
|
||
('ObjName': 'TPattern',
|
||
'Desc': ('TPattern有以下属性: '),
|
||
'AttrInfo': (
|
||
('attrName': 'PatternType', 'type': 'string', 'desc': '图案样式', 'value': array()),
|
||
('attrName': '', 'type': '', 'desc': '{颜色}:前景色,{ForegroundColor}和{ForegroundThemeColor}只能设置一种', 'value': array()),
|
||
('attrName': 'ForegroundColor', 'type': 'string', 'desc': 'RGB颜色', 'value': array()),
|
||
('attrName': 'ForegroundThemeColor', 'type': 'int', 'desc': '主题颜色', 'value': array()),
|
||
('attrName': 'ForegroundThemeColorTint', 'type': 'int', 'desc': '主题颜色的色调', 'value': array()),
|
||
('attrName': '', 'type': '', 'desc': '{颜色}:背景色,{BackgroundColor}和{BackgroundThemeColor}只能设置一种', 'value': array()),
|
||
('attrName': 'BackgroundColor', 'type': 'string', 'desc': 'RGB颜色', 'value': array()),
|
||
('attrName': 'BackgroundThemeColor', 'type': 'int', 'desc': '主题颜色', 'value': array()),
|
||
('attrName': 'BackgroundThemeColorTint', 'type': 'int', 'desc': '主题颜色的色调', 'value': array()),
|
||
),
|
||
'Demo': '',
|
||
),
|
||
('ObjName': 'TGradient',
|
||
'Desc': ('TGradient有以下属性: '),
|
||
'AttrInfo': (
|
||
('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',
|
||
'Desc': ('TProtection有以下属性: '),
|
||
'AttrInfo': (
|
||
('attrName': 'Lock', 'type': 'boolean', 'desc': '是否锁定,默认FALSE', 'value': array()),
|
||
('attrName': 'Hide', 'type': 'boolean', 'desc': '是否隐藏,默认FALSE', 'value': array()),
|
||
),
|
||
'Demo': '',
|
||
),
|
||
('ObjName': 'THeaderFooter',
|
||
'Desc': ('THeaderFooter有以下属性: '),
|
||
'AttrInfo': (
|
||
('attrName': 'DifferentOddEven', 'type': 'boolean', 'desc': '是否分别设定奇数和偶数页页眉和页脚,若为FALSE(默认)时,仅需设置{OddHeader}和{OddFooter}', 'value': array()),
|
||
('attrName': 'DifferentFirst', 'type': 'boolean', 'desc': '是否单独设定首页页眉页脚', 'value': array()),
|
||
('attrName': 'ScaleWithDoc', 'type': 'boolean', 'desc': '是否随文档一起缩放', 'value': array()),
|
||
('attrName': 'AlignWithMargin', 'type': 'boolean', 'desc': '是否与页边距对齐', 'value': array()),
|
||
('attrName': 'OddHeader', 'type': 'string', 'desc': '奇数页页眉控制符', 'value': array()),
|
||
('attrName': 'OddFooter', 'type': 'string', 'desc': '奇数页页脚控制符', 'value': array()),
|
||
('attrName': 'EvenHeader', 'type': 'string', 'desc': '偶数页页眉控制符,仅{DifferentOddEven} = TRUE 时有效', 'value': array()),
|
||
('attrName': 'EvenFooter', 'type': 'string', 'desc': '偶数页页脚控制符,仅{DifferentOddEven} = TRUE 时有效', 'value': array()),
|
||
('attrName': 'FirstHeader', 'type': 'string', 'desc': '首页页眉控制符,仅{DifferentFirst} = TRUE 时有效', 'value': array()),
|
||
('attrName': 'FirstFooter', 'type': 'string', 'desc': '首页页脚控制符,仅{DifferentFirst} = TRUE 时有效', 'value': array()),
|
||
),
|
||
'Demo': '',
|
||
),
|
||
('ObjName': 'TMargins',
|
||
'Desc': ('TMargins有以下属性: '),
|
||
'AttrInfo': (
|
||
('attrName': 'Left', 'type': 'double', 'desc': '左页边距', 'value': array()),
|
||
('attrName': 'Right', 'type': 'double', 'desc': '右页边距', 'value': array()),
|
||
('attrName': 'Top', 'type': 'double', 'desc': '上页边距', 'value': array()),
|
||
('attrName': 'Bottom', 'type': 'double', 'desc': '下页边距', 'value': array()),
|
||
('attrName': 'Header', 'type': 'double', 'desc': '页眉页边距', 'value': array()),
|
||
('attrName': 'Footer', 'type': 'double', 'desc': '页脚页边距', 'value': array()),
|
||
),
|
||
'Demo': '',
|
||
),
|
||
('ObjName': 'TPageLayout',
|
||
'Desc': ('TPageLayout有以下属性: '),
|
||
'AttrInfo': (
|
||
('attrName': 'PaperSize', 'type': 'int', 'desc': '纸张大小', 'value': array()),
|
||
('attrName': '', 'type': '', 'desc': '{Scale}和{FitToWidth},{FitToHeight}只能设置一种', 'value': array()),
|
||
('attrName': 'Scale', 'type': 'int', 'desc': '缩放比例(%)', 'value': array()),
|
||
('attrName': 'FitToWidth', 'type': 'int', 'desc': '页宽', 'value': array()),
|
||
('attrName': 'FitToHeight', 'type': 'int', 'desc': '页高', 'value': array()),
|
||
('attrName': 'UseFirstPageNumber', 'type': 'bool', 'desc': '是否启用起始页码', 'value': array()),
|
||
('attrName': 'FirstPageNumber', 'type': 'int', 'desc': '起始页码,{UseFirstPageNumber}为true时有效', 'value': array()),
|
||
('attrName': 'Orientation', 'type': 'string', 'desc': '纸张方向', 'value': array('"landscape": 横向', '"portrait": 纵向')),
|
||
('attrName': 'PageOrder', 'type': 'string', 'desc': '打印顺序', 'value': array('nil(默认): 先列后行', '"overThenDown": 先行后列')),
|
||
('attrName': 'BlackAndWhite', 'type': 'boolean', 'desc': '单色打印', 'value': array()),
|
||
('attrName': 'Draft', 'type': 'boolean', 'desc': '是否开启草稿质量', 'value': array()),
|
||
('attrName': 'CellComments', 'type': 'string', 'desc': '注释', 'value': array('nil(默认): 无', '"atEnd": 工作表末尾', '"asDisplayed": 如同工作表中的显示')),
|
||
('attrName': 'CellError', 'type': 'string', 'desc': '错误单元格打印为', 'value': array('nil(默认): 显示值', '"blank": 空白', '"dash": "--"', "NA": "#N/A")),
|
||
),
|
||
'Demo': '',
|
||
),
|
||
('ObjName': 'TAppProperty',
|
||
'Desc': ('TAppProperty有以下属性: '),
|
||
'AttrInfo': (
|
||
('attrName': 'Application', 'type': 'string', 'desc': '应用程序', 'value': array()),
|
||
('attrName': 'DocSecurity', 'type': 'boolean', 'desc': '', 'value': array()),
|
||
('attrName': 'ScaleCrop', 'type': 'string', 'desc': '', 'value': array('"false"(默认)', '"true"')),
|
||
('attrName': 'Manager', 'type': 'string', 'desc': '主管', 'value': array()),
|
||
('attrName': 'LinksUpToDate', 'type': 'string', 'desc': '', 'value': array('"false"(默认)', '"true"')),
|
||
('attrName': 'SharedDoc', 'type': 'string', 'desc': '', 'value': array('"false"(默认)', '"true"')),
|
||
('attrName': 'HyperlinkBase', 'type': 'string', 'desc': '超链接基础', 'value': array()),
|
||
('attrName': 'HyperlinksChanged', 'type': 'string', 'desc': '', 'value': array('"false"(默认)', '"true"')),
|
||
('attrName': 'AppVersion', 'type': 'string', 'desc': '应用程序版本', 'value': array()),
|
||
),
|
||
'Demo': '',
|
||
),
|
||
('ObjName': 'THyperLink',
|
||
'Desc': ('THyperLink有以下属性: '),
|
||
'AttrInfo': (
|
||
('attrName': 'LinkType', 'type': 'string', 'desc': '超链接类型', 'value': array('"external": 外部超链接', '"location"': 内部超链接)),
|
||
('attrName': 'LinkUrl', 'type': 'string', 'desc': '超链接地址', 'value': array()),
|
||
('attrName': 'Tooltip', 'type': 'string', 'desc': '超链接悬浮提示内容', 'value': array()),
|
||
),
|
||
'Demo': '',
|
||
),
|
||
('ObjName': 'TPicture',
|
||
'Desc': ('TPicture有以下属性: '),
|
||
'AttrInfo': (
|
||
('attrName': 'Image', 'type': 'binary', 'desc': '图片的二进制数据', 'value': array()),
|
||
('attrName': 'Descr', 'type': 'binary', 'desc': '图片描述', 'value': array()),
|
||
),
|
||
'Demo': '',
|
||
),
|
||
('ObjName': 'TPictureFormat',
|
||
'Desc': ('TPictureFormat有以下属性: '),
|
||
'AttrInfo': (
|
||
('attrName': 'BegColOff', 'type': 'int', 'desc': '开始列偏移', 'value': array()),
|
||
('attrName': 'BegRowOff', 'type': 'int', 'desc': '开始行偏移', 'value': array()),
|
||
('attrName': 'EndColOff', 'type': 'int', 'desc': '结束列偏移', 'value': array()),
|
||
('attrName': 'EndRowOff', 'type': 'int', 'desc': '结束行偏移', 'value': array()),
|
||
),
|
||
'Demo': '',
|
||
),
|
||
('ObjName': 'TProtect',
|
||
'Desc': ('TProtect有以下属性: '),
|
||
'AttrInfo': (
|
||
('attrName': 'EditObjects', 'type': 'bool', 'desc': '编辑方案', 'value': array()),
|
||
('attrName': 'EditScenarios', 'type': 'bool', 'desc': '编辑方案', 'value': array()),
|
||
('attrName': 'FormatCells', 'type': 'bool', 'desc': '设置单元格格式', 'value': array()),
|
||
('attrName': 'FormatColumns', 'type': 'bool', 'desc': '设置列格式', 'value': array()),
|
||
('attrName': 'FormatRows', 'type': 'bool', 'desc': '设置行格式', 'value': array()),
|
||
('attrName': 'InsertColumns', 'type': 'bool', 'desc': '插入行', 'value': array()),
|
||
('attrName': 'InsertRows', 'type': 'bool', 'desc': '插入列', 'value': array()),
|
||
('attrName': 'InsertHyperlinks', 'type': 'bool', 'desc': '插入超链接', 'value': array()),
|
||
('attrName': 'DeleteColumns', 'type': 'bool', 'desc': '删除列', 'value': array()),
|
||
('attrName': 'DeleteRows', 'type': 'bool', 'desc': '删除行', 'value': array()),
|
||
('attrName': 'SelectLockedCells', 'type': 'bool', 'desc': '选定锁定的单元格', 'value': array()),
|
||
('attrName': 'Sort', 'type': 'bool', 'desc': '排序', 'value': array()),
|
||
('attrName': 'AutoFilter', 'type': 'bool', 'desc': '使用自动筛选', 'value': array()),
|
||
('attrName': 'PivotTables', 'type': 'bool', 'desc': '使用自动透视表和自动透视图', 'value': array()),
|
||
),
|
||
'Demo': '',
|
||
),
|
||
('ObjName': 'TSheetView',
|
||
'Desc': ('TSheetView有以下属性: '),
|
||
'AttrInfo': (
|
||
('attrName': 'ShowGridLines', 'type': 'bool', 'desc': '网格线', 'value': array()),
|
||
('attrName': 'ShowRowColHeaders', 'type': 'bool', 'desc': '标题', 'value': array()),
|
||
('attrName': 'View', 'type': 'bool', 'desc': '工作簿视图', 'value': array('"pageBreakPreview": 分页预览')),
|
||
('attrName': 'ZoomScale', 'type': 'string', 'desc': '缩放比例(%)', 'value': array()),
|
||
),
|
||
'Demo': '',
|
||
),
|
||
('ObjName': 'TPane',
|
||
'Desc': ('TPane有以下属性: '),
|
||
'AttrInfo': (
|
||
('attrName': 'XSplit', 'type': 'int', 'desc': '按列分割', 'value': array()),
|
||
('attrName': 'YSplit', 'type': 'int', 'desc': '按行分割', 'value': array()),
|
||
('attrName': 'ActivePane', 'type': 'string', 'desc': '激活窗格', 'value': array('"bottomRight": 都设置{XSplit}和{YSplit}时为该值', '"topRight": 仅设置{XSplit}时', '"bottomLeft": 仅设置{YSplit}时')),
|
||
('attrName': 'State', 'type': 'string', 'desc': '冻结窗口', 'value': array('"frozen"')),
|
||
('attrName': 'TopLeftCell', 'type': 'string', 'desc': '顶部单元格,根据{ActivePane}的值设定', 'value': array()),
|
||
),
|
||
'Demo': '',
|
||
),
|
||
('ObjName': 'TCalcPr',
|
||
'Desc': ('TCalcPr有以下属性: '),
|
||
'AttrInfo': (
|
||
('attrName': 'CalcMode', 'type': 'string', 'desc': '工作簿计算模式', 'value': array('nil(默认): 自动重算', '"autoNoTable": 除模拟运算表外自动重算', '"manual": 手动重算')),
|
||
('attrName': 'RefMode', 'type': 'string', 'desc': 'R1C1引用样式', 'value': array('nil(默认): 不启用', '"R1C1": 启用R1C1引用样式')),
|
||
('attrName': 'Iterate', 'type': 'bool', 'desc': '是否启用迭代计算', 'value': array()),
|
||
('attrName': 'IterateCount', 'type': 'int', 'desc': '最多迭代次数', 'value': array()),
|
||
('attrName': 'IterateDelta', 'type': 'double', 'desc': '最大误差', 'value': array()),
|
||
('attrName': 'CalcOnSave', 'type': 'bool', 'desc': '保存工作簿之前重新计算,{CalcMode}为"manual"时有效', 'value': array()),
|
||
('attrName': 'ConCurrentCalc', 'type': 'bool', 'desc': '是否启用多线程计算', 'value': array()),
|
||
('attrName': 'ConCurrentManualCount', 'type': 'int', 'desc': '自定义计算线程数', 'value': array()),
|
||
('attrName': 'FullPrecision', 'type': 'bool', 'desc': '是否采用完整精度', 'value': array()),
|
||
),
|
||
'Demo': '',
|
||
),
|
||
);
|
||
End
|