This commit is contained in:
csh
2023-01-10 09:59:07 +08:00
parent 9b8b7f79d9
commit a4ff2eae83
29 changed files with 1156 additions and 427 deletions
+10 -15
View File
@@ -1,4 +1,4 @@
class(xlsxXml).CodePage('中文');
TOfficeApi().CodePage('中文');
testCount := 0;
sheetName := "你好";
@@ -207,10 +207,6 @@ End;
[err, col, row] := excel.SplitCellName("AK47");
if not err then println("[success] {} = col : {}, row = {}", "SplitCellName", col, row);
// JoinCellName
[err, errmsg] := excel.JoinCellName("AK", 47);
PrintInfo("JoinCellName", err, errmsg);
// ColumnNameToNumber
[err, errmsg] := excel.ColumnNameToNumber("AK");
PrintInfo("ColumnNameToNumber", err, errmsg);
@@ -224,12 +220,12 @@ PrintInfo("ColumnNumberToName", err, errmsg);
if not err then println("[success] {} = col : {}, row = {}", "CellNameToCoordinates", col, row);
// RGBToHSL
[err, h, s, l] := excel.RGBToHSL(255, 15, 33);
if not err then println("[success] {} = {}, {}, {}", "RGBToHSL", h, s, l);
[h, s, l] := excel.RGBToHSL(255, 15, 33);
println("[success] {} = {}, {}, {}", "RGBToHSL", h, s, l);
// HSLToRGB
[err, r, g, b] := excel.HSLToRGB(h, s, l);
if not err then println("[success] {} = {}, {}, {}", "HSLToRGB", h, s, l);
[r, g, b] := excel.HSLToRGB(h, s, l);
println("[success] {} = {}, {}, {}", "HSLToRGB", r, g, b);
// NewStyle
style := TOfficeObj('TStyle');
@@ -380,11 +376,11 @@ println("[success] GetDefaultSheet = {}", sheet);
// SetCellHyperLink
link := TOfficeObj('THyperLink');
link.LinkType := "Location";
link.LinkType := "location";
link.LinkUrl := sheetName $ "!A1";
excel.SetCellHyperLink(sheetName2, 'A1', link);
link := TOfficeObj('THyperLink');
link.LinkType := "External";
link.LinkType := "external";
link.LinkUrl := "https://www.baidu.com";
link.Tooltip := "超链接悬浮提示";
excel.SetCellValue(sheetName2, 'A2', '超链接');
@@ -393,7 +389,7 @@ println("[success] SetCellHyperLink");
// GetCellHyperLink
hyperlink := excel.GetCellHyperLink(sheetName2, 'A2');
println("[success] GetCellHyperLink LinkType = {}, LinkUrl = {}, Tooltip = {}", hyperlink.Value('LinkType'), hyperlink.Value('LinkUrl'), hyperlink.Value('Tooltip'));
println("[success] GetCellHyperLink LinkType = {}, LinkUrl = {}, Tooltip = {}", hyperlink.LinkType, hyperlink.LinkUrl, hyperlink.Tooltip);
// SetSheetBackground
ret := readfile(rwBinary(), "", "C:\\Users\\csh05\\Pictures\\Saved Pictures\\1.jpg", 0, 1024000, data);
@@ -454,11 +450,10 @@ core.Title := "标题";
core.Subject := "主题";
core.Creator := "作者";
excel.SetCoreProps(core);
println("[success] SetCoreProps");
// GetCoreProps
core := excel.GetCoreProps();
println("[success] GetCoreProps Title = {}, subject = {}, Creator = {}", core.Value("Title"), core.Value("Subject"), core.Value("Creator"));
println("[success] GetCoreProps Title = {}, subject = {}, Creator = {}", core.Title, core.Subject, core.Creator);
// SetAppProps
appProps := TOfficeObj('TAppProperty');
@@ -476,7 +471,7 @@ println("[success] SetAppProps");
// GetAppProps
app_props := excel.GetAppProps();
println("[success] GetAppProps Manager = {}, Company = {}, Application = {}", app_props.Value('Manager'), app_props.Value('Company'), app_props.Value('Application'));
println("[success] GetAppProps Manager = {}, Company = {}, Application = {}", app_props.Manager, app_props.Company, app_props.Application);
[err, errmsg] := excel.saveas("", "d:\\temp\\test.xlsx");
println("saveas : {}", err);
+17
View File
@@ -56,6 +56,9 @@ _13_TNumbering(docx);
///TDocxChart
_14_TDocxChart(docx);
///TOfficeApi
_15_TOfficeApi(docx);
///附注
_Annotation(docx);
@@ -790,6 +793,20 @@ Begin
println(' >>OK\n');
End;
///TOfficeApi
Function _15_TOfficeApi(docx);
Begin
paragraph := sysparams['Test'];
_PrintMsg('TOfficeApi接口');
_AddTitle(docx, 'TOfficeApi', 1);
_AddTitle(docx, 'TOfficeApi接口', 2);
conf := _LoadClassInfo(docx.GetPath() + '\\funcext\\TSOffice\\TSUtils\\TOffice.tsf', 'TOffice');
_AddFunctionHelpInfo(docx, '' $ paragraph $ '.1.', conf, 3);
println(' >>OK\n');
End;
Function _AddTitle(docx, subject, level);
Begin
leftIndent := array((0,0), (425,425), (453,850), (708,1508));