v1.4.6
This commit is contained in:
@@ -1,28 +1,28 @@
|
||||
path := ExtractFileDir(ExtractFileDir(PluginPath()));
|
||||
{$IFNDEF Win32}
|
||||
path := path + '\\funcext\\TSOffice\\TSExcelFile.tsf';
|
||||
path := path + '\\funcext\\TSOffice\\TSXlsxFile.tsf';
|
||||
{$ELSE}
|
||||
path := path + '/funcext/TSOffice/TSExcelFile.tsf';
|
||||
path := path + '/funcext/TSOffice/TSXlsxFile.tsf';
|
||||
{$ENDIF}
|
||||
funcs := LoadClassInfo(path);
|
||||
|
||||
testing := 1;
|
||||
file := new TSExcelFile();
|
||||
file := new TSXlsxFile();
|
||||
[err, errinfo] := file.NewFile();
|
||||
if err then
|
||||
return PrintError("NewFile", err, errinfo);
|
||||
PrintSuccess("NewFile", testing++);
|
||||
|
||||
file.SetSheetName('Sheet1', 'ExcelFile');
|
||||
file.SetSheetName('Sheet1', 'XlsxFile');
|
||||
PrintSuccess("SetSheetName", testing++);
|
||||
|
||||
file.NewSheet("Functions");
|
||||
PrintSuccess("NewSheet", testing++);
|
||||
|
||||
file.SetDefaultSheet('ExcelFile');
|
||||
file.SetDefaultSheet('TSXlsxFile');
|
||||
|
||||
richtext := TOfficeObj('TRichText');
|
||||
txt1 := richtext.AddText('TSExcelFile类 ');
|
||||
txt1 := richtext.AddText('TSXlsxFile类 ');
|
||||
txt1.Font.Size := 35;
|
||||
txt1.Font.Color := "FF0000";
|
||||
txt1.Font.Bold := 1;
|
||||
@@ -34,14 +34,14 @@ txt2.Font.Bold := 1;
|
||||
txt2.Font.Italic := 1;
|
||||
txt2.Font.Color := "FFC0CB";
|
||||
|
||||
file.SetCellRichText('ExcelFile', 'A1', richtext);
|
||||
file.SetCellRichText('XlsxFile', 'A1', richtext);
|
||||
PrintSuccess("SetCellRichText", testing++);
|
||||
[err, richText] := file.GetCellRichText('ExcelFile', 'A1');
|
||||
[err, richText] := file.GetCellRichText('XlsxFile', 'A1');
|
||||
if err then
|
||||
return PrintError("GetCellRichText", err, errinfo);
|
||||
PrintSuccess("GetCellRichText", testing++);
|
||||
|
||||
file.MergeCell('ExcelFile', 'A1', 'C1');
|
||||
file.MergeCell('XlsxFile', 'A1', 'C1');
|
||||
PrintSuccess("MergeCell", testing++);
|
||||
|
||||
|
||||
@@ -65,15 +65,15 @@ style.Fill.Gradient.Stop2.Color := "E0EBF5";
|
||||
styleId := file.NewStyle(style);
|
||||
PrintSuccess("NewStyle", testing++);
|
||||
|
||||
file.SetCellStyle("ExcelFile", 'A1', 'C1', styleId);
|
||||
file.SetCellStyle("XlsxFile", '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);
|
||||
file.SetCellValue("XlsxFile", "A3", "索引");
|
||||
file.SetCellValue("XlsxFile", "B3", "函数名称");
|
||||
file.SetCellValue("XlsxFile", "C3", "功能");
|
||||
file.SetColWidth("XlsxFile", "A", "A", 6);
|
||||
file.SetColWidth("XlsxFile", "B", "B", 55);
|
||||
file.SetColWidth("XlsxFile", "C", "C", 100);
|
||||
file.SetCellStyle("XlsxFile", "A3", "C3", styleId);
|
||||
|
||||
|
||||
style2 := TOfficeObj("TStyle");
|
||||
@@ -108,9 +108,9 @@ 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']);
|
||||
file.SetCellValue("XlsxFile", cell0, i+1);
|
||||
file.SetCellValue("XlsxFile", cell1, funcs[i]['funcname']);
|
||||
file.SetCellValue("XlsxFile", cell2, funcs[i]['name']);
|
||||
|
||||
str := funcs[i]['name'] + "\nFunction " + funcs[i]['funcname'] + funcs[i]['comment'];
|
||||
arr := str2array(str, "\n");
|
||||
@@ -130,15 +130,15 @@ Begin
|
||||
hyperlink.LinkType := "location";
|
||||
hyperlink.LinkUrl := "Functions!" $ c1;
|
||||
|
||||
file.SetCellHyperLink("ExcelFile", cell1, hyperlink);
|
||||
file.SetCellStyle("ExcelFile", cell1, cell1, styleId4);
|
||||
file.SetCellHyperLink("XlsxFile", cell1, hyperlink);
|
||||
file.SetCellStyle("XlsxFile", cell1, cell1, styleId4);
|
||||
|
||||
End
|
||||
|
||||
file.SetColWidth('Functions', 'A', 'A', 120);
|
||||
PrintSuccess('SetColWidth', testing++);
|
||||
|
||||
saveName := utf8toansi("ExcelFile使用帮助.xlsx");
|
||||
saveName := utf8toansi("XlsxFile使用帮助.xlsx");
|
||||
[err, errinfo] := file.SaveAs('', saveName);
|
||||
if err then
|
||||
return PrintError("SaveAs", err, errinfo);
|
||||
Reference in New Issue
Block a user