Compare commits
No commits in common. "2384ca42b5454e0d8d2bba2f61add3a56bcac371" and "8f6bdd212b3d654be10faf1ccb96349fbc6aaf8b" have entirely different histories.
2384ca42b5
...
8f6bdd212b
|
|
@ -84,7 +84,7 @@ Function _0_AddTitle(docx);
|
||||||
Begin
|
Begin
|
||||||
_PrintMsg('AddTitle');
|
_PrintMsg('AddTitle');
|
||||||
p := _AddTitle(docx, '天软DOCX文档操作接口帮助文档', 0);//添加文档标题
|
p := _AddTitle(docx, '天软DOCX文档操作接口帮助文档', 0);//添加文档标题
|
||||||
p.Font.Size := 24;
|
p.Font.Size := 48;
|
||||||
p.Apply();
|
p.Apply();
|
||||||
for i:=0 to 16 do
|
for i:=0 to 16 do
|
||||||
docx.AddLineBreak(-1);//换行符
|
docx.AddLineBreak(-1);//换行符
|
||||||
|
|
@ -132,7 +132,7 @@ Begin
|
||||||
preface.Font.Name := '宋体';
|
preface.Font.Name := '宋体';
|
||||||
preface.Font.Color := 'FF0000';
|
preface.Font.Color := 'FF0000';
|
||||||
preface.Font.Bold := true;
|
preface.Font.Bold := true;
|
||||||
preface.Font.Size := 16;
|
preface.Font.Size := 32;
|
||||||
p1 := docx.AddParagraph(preface, -1, nil);
|
p1 := docx.AddParagraph(preface, -1, nil);
|
||||||
|
|
||||||
println(' >>OK\n');
|
println(' >>OK\n');
|
||||||
|
|
@ -303,7 +303,7 @@ Begin
|
||||||
p1.Run.SetText('本文档由天软科技制作。');
|
p1.Run.SetText('本文档由天软科技制作。');
|
||||||
p1.Run.rPr.Name := '宋体';
|
p1.Run.rPr.Name := '宋体';
|
||||||
p1.Run.rPr.Bold := true;
|
p1.Run.rPr.Bold := true;
|
||||||
p1.Run.rPr.Size := 16;
|
p1.Run.rPr.Size := 32;
|
||||||
p1.Run.rPr.Color := 'FF0000';
|
p1.Run.rPr.Color := 'FF0000';
|
||||||
p2 := docx.AddParagraph(p1, -1, nil);
|
p2 := docx.AddParagraph(p1, -1, nil);
|
||||||
//插入批注
|
//插入批注
|
||||||
|
|
@ -391,7 +391,7 @@ Begin
|
||||||
p1.Run.SetText( '插入案例。' );
|
p1.Run.SetText( '插入案例。' );
|
||||||
p1.Run.rPr.Name := '宋体';
|
p1.Run.rPr.Name := '宋体';
|
||||||
p1.Run.rPr.Bold := true;
|
p1.Run.rPr.Bold := true;
|
||||||
p1.Run.rPr.Size := 16;
|
p1.Run.rPr.Size := 32;
|
||||||
p1.Run.rPr.Color := 'FF0000';
|
p1.Run.rPr.Color := 'FF0000';
|
||||||
pAddRevision := docx.AddParagraph(p1, -1, nil);
|
pAddRevision := docx.AddParagraph(p1, -1, nil);
|
||||||
//插入修订
|
//插入修订
|
||||||
|
|
@ -410,7 +410,7 @@ Begin
|
||||||
p1.Run.SetText( '删除修订案例。' );
|
p1.Run.SetText( '删除修订案例。' );
|
||||||
p1.Run.rPr.Name := '宋体';
|
p1.Run.rPr.Name := '宋体';
|
||||||
p1.Run.rPr.Bold := true;
|
p1.Run.rPr.Bold := true;
|
||||||
p1.Run.rPr.Size := 16;
|
p1.Run.rPr.Size := 32;
|
||||||
p1.Run.rPr.Color := 'FF0000';
|
p1.Run.rPr.Color := 'FF0000';
|
||||||
pDelRevision := docx.AddParagraph(p1, -1, nil);
|
pDelRevision := docx.AddParagraph(p1, -1, nil);
|
||||||
//删除修订
|
//删除修订
|
||||||
|
|
@ -500,7 +500,7 @@ Begin
|
||||||
help.Font.Name := '宋体';
|
help.Font.Name := '宋体';
|
||||||
help.Font.Color := 'FF0000';
|
help.Font.Color := 'FF0000';
|
||||||
help.Font.Bold := true;
|
help.Font.Bold := true;
|
||||||
help.Font.Size := 15;
|
help.Font.Size := 30;
|
||||||
p1 := docx.AddParagraph(help, -1, nil);
|
p1 := docx.AddParagraph(help, -1, nil);
|
||||||
|
|
||||||
section := docx.Sections(-1);//获取缺省章节
|
section := docx.Sections(-1);//获取缺省章节
|
||||||
|
|
@ -514,10 +514,10 @@ Begin
|
||||||
p.Format.SpaceAfter := 0;
|
p.Format.SpaceAfter := 0;
|
||||||
p.Font.Name := '宋体';
|
p.Font.Name := '宋体';
|
||||||
p.Font.Color := 'FF0000';
|
p.Font.Color := 'FF0000';
|
||||||
p.Font.Size := 8;
|
p.Font.Size := 16;
|
||||||
p2 := footer.AddParagraph(p, -1, nil);
|
p2 := footer.AddParagraph(p, -1, nil);
|
||||||
p.Font.Size := 8;
|
p.Font.Size := 18;
|
||||||
pgno := footer.AddPageNumber('第 {-3} 页,共 {1} 页', p.Font); //添加页码
|
pgno := footer.AddPageNumber('第 {0} 页,共 {1} 页', p.Font); //添加页码
|
||||||
pgno.Format.Alignment := 'center'; //据中对齐
|
pgno.Format.Alignment := 'center'; //据中对齐
|
||||||
pgno.Format.SpaceAfter := 0;
|
pgno.Format.SpaceAfter := 0;
|
||||||
pgno.Apply();
|
pgno.Apply();
|
||||||
|
|
@ -530,7 +530,7 @@ Begin
|
||||||
//p.Format.Bdr.Bottom.val := 'single';//页眉横线
|
//p.Format.Bdr.Bottom.val := 'single';//页眉横线
|
||||||
p.Font.Name := '宋体';
|
p.Font.Name := '宋体';
|
||||||
p.Font.Color := 'FF0000';
|
p.Font.Color := 'FF0000';
|
||||||
p.Font.Size := 8;
|
p.Font.Size := 16;
|
||||||
p1 := header.AddParagraph(p, -1, nil);
|
p1 := header.AddParagraph(p, -1, nil);
|
||||||
|
|
||||||
println(' >>OK\n');
|
println(' >>OK\n');
|
||||||
|
|
@ -583,19 +583,19 @@ Begin
|
||||||
pTest := docx.AddParagraph(p1, -1, nil);
|
pTest := docx.AddParagraph(p1, -1, nil);
|
||||||
//修改部分文字字体
|
//修改部分文字字体
|
||||||
range := pTest.Range(3,2);
|
range := pTest.Range(3,2);
|
||||||
range.Font.Size := 16;
|
range.Font.Size := 32;
|
||||||
range.Font.Color := 'FF0000';
|
range.Font.Color := 'FF0000';
|
||||||
range.Font.Bold := true;
|
range.Font.Bold := true;
|
||||||
range.Apply();
|
range.Apply();
|
||||||
//添加文字1
|
//添加文字1
|
||||||
range1 := pTest.AddText(5, '科技开发有限');
|
range1 := pTest.AddText(5, '科技开发有限');
|
||||||
range1.Font.Size := 14;
|
range1.Font.Size := 28;
|
||||||
range1.Font.Color := '00FF00';
|
range1.Font.Color := '00FF00';
|
||||||
range1.Font.Bold := true;
|
range1.Font.Bold := true;
|
||||||
range1.Apply();
|
range1.Apply();
|
||||||
//添加文字2
|
//添加文字2
|
||||||
range2 := pTest.AddText(0, '广东省');
|
range2 := pTest.AddText(0, '广东省');
|
||||||
range2.Font.Size := 14;
|
range2.Font.Size := 28;
|
||||||
range2.Font.Color := '0000FF';
|
range2.Font.Color := '0000FF';
|
||||||
range2.Font.Bold := true;
|
range2.Font.Bold := true;
|
||||||
range2.Apply();
|
range2.Apply();
|
||||||
|
|
@ -603,7 +603,7 @@ Begin
|
||||||
//r.Text := 'Tinysoft';
|
//r.Text := 'Tinysoft';
|
||||||
|
|
||||||
r := pTest.AddText(-1, ':www.tinysoft.com.cn');//段落后追加
|
r := pTest.AddText(-1, ':www.tinysoft.com.cn');//段落后追加
|
||||||
r.Font.Size := 10;
|
r.Font.Size := 20;
|
||||||
r.Font.Color := '0000FF';
|
r.Font.Color := '0000FF';
|
||||||
r.Font.Bold := true;
|
r.Font.Bold := true;
|
||||||
r.Apply();
|
r.Apply();
|
||||||
|
|
@ -656,7 +656,7 @@ Begin
|
||||||
p := TOfficeObj('TParagraph');
|
p := TOfficeObj('TParagraph');
|
||||||
p.Format.numPr.Level := 0;//项目编号
|
p.Format.numPr.Level := 0;//项目编号
|
||||||
p.Format.numPr.numId := docx.NumberingObject().NumberId('bullet', i); //项目编号
|
p.Format.numPr.numId := docx.NumberingObject().NumberId('bullet', i); //项目编号
|
||||||
p.Font.Size := 14;
|
p.Font.Size := 28;
|
||||||
p.Font.Color := 'FF0000';
|
p.Font.Color := 'FF0000';
|
||||||
p.Font.Bold := true;
|
p.Font.Bold := true;
|
||||||
p.Format.LeftIndent := 700;//段落左边距
|
p.Format.LeftIndent := 700;//段落左边距
|
||||||
|
|
@ -829,7 +829,7 @@ Begin
|
||||||
p.Font.Name := '宋体';
|
p.Font.Name := '宋体';
|
||||||
p.Font.Color := 'FF0000';
|
p.Font.Color := 'FF0000';
|
||||||
p.Font.Bold := true;
|
p.Font.Bold := true;
|
||||||
p.Font.Size := 15;
|
p.Font.Size := 29;
|
||||||
p1 := docx.AddParagraph(p, -1, nil);
|
p1 := docx.AddParagraph(p, -1, nil);
|
||||||
|
|
||||||
println(' >>OK\n');
|
println(' >>OK\n');
|
||||||
|
|
@ -940,10 +940,10 @@ Function _AddClassHelpTable(docx, data);
|
||||||
Begin
|
Begin
|
||||||
//设置边框属性
|
//设置边框属性
|
||||||
tbl := docx.CreateTable(data, true, true);
|
tbl := docx.CreateTable(data, true, true);
|
||||||
tbl.Format.Borders.Top.Size := 12;
|
tbl.Format.Borders.Top.Size := 24;
|
||||||
tbl.Format.Borders.Left.Size := 12;
|
tbl.Format.Borders.Left.Size := 24;
|
||||||
tbl.Format.Borders.Bottom.Size := 12;
|
tbl.Format.Borders.Bottom.Size := 24;
|
||||||
tbl.Format.Borders.Right.Size := 12;
|
tbl.Format.Borders.Right.Size := 24;
|
||||||
tbl.Format.Borders.Top.Val := 'thinThickThinMediumGap';
|
tbl.Format.Borders.Top.Val := 'thinThickThinMediumGap';
|
||||||
tbl.Format.Borders.Left.Val := 'thinThickThinMediumGap';
|
tbl.Format.Borders.Left.Val := 'thinThickThinMediumGap';
|
||||||
tbl.Format.Borders.Bottom.Val := 'thinThickThinMediumGap';
|
tbl.Format.Borders.Bottom.Val := 'thinThickThinMediumGap';
|
||||||
|
|
@ -1144,7 +1144,7 @@ Begin
|
||||||
if title then Begin
|
if title then Begin
|
||||||
p.Format.numPr.Level := 0;//项目编号
|
p.Format.numPr.Level := 0;//项目编号
|
||||||
p.Format.numPr.numId := numId;
|
p.Format.numPr.numId := numId;
|
||||||
p.Font.Size := 14;
|
p.Font.Size := 28;
|
||||||
p.Font.Color := 'FF0000';
|
p.Font.Color := 'FF0000';
|
||||||
p.Font.Bold := true;
|
p.Font.Bold := true;
|
||||||
p.Format.LeftIndent := 500;//段落左边距
|
p.Format.LeftIndent := 500;//段落左边距
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -8,12 +8,9 @@ TSOffice 项目:纯 TSL 代码实现 excel、word 文件读写
|
||||||
|
|
||||||
对应文件夹的dll文件按如下要求
|
对应文件夹的dll文件按如下要求
|
||||||
|
|
||||||
|
- `fmt_pubkrnl_plugin` 放入 tsl 安装根目录下 Plugin 文件夹
|
||||||
- `office_plugin` 放入 tsl 安装根目录下 Plugin 文件夹
|
- `office_plugin` 放入 tsl 安装根目录下 Plugin 文件夹
|
||||||
|
|
||||||
可选:
|
|
||||||
|
|
||||||
- `fmt_pubkrnl_plugin` 放入 tsl 安装根目录下 Plugin 文件夹,若需要执行Demo文件夹下的[ExcelHelp.tsl](./Demo/ExcelHelp.tsl)和[WordHelp.tsl](./Demo/WordHelp.tsl),需要部署改动态库
|
|
||||||
|
|
||||||
### Linux
|
### Linux
|
||||||
|
|
||||||
根据架构选择aarch64或x86版本将对应文件夹内容进行部署
|
根据架构选择aarch64或x86版本将对应文件夹内容进行部署
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -1,4 +1,4 @@
|
||||||
// Version 1.3.5
|
// Version 1.3.0
|
||||||
|
|
||||||
Function TOfficeObj(n);
|
Function TOfficeObj(n);
|
||||||
Begin
|
Begin
|
||||||
|
|
@ -5851,7 +5851,7 @@ type TwrPr=class(NodeInfo)
|
||||||
,("field":"Strike","name":"w:strike","obj":Strike,"attrEx":"","nodeType":"empty","attrName":"", "desc":"单个删除线", "class":"")
|
,("field":"Strike","name":"w:strike","obj":Strike,"attrEx":"","nodeType":"empty","attrName":"", "desc":"单个删除线", "class":"")
|
||||||
,("field":"dStrike","name":"w:dstrike","obj":dStrike,"attrEx":"w:val","nodeType":"","attrName":"", "desc":"两个删除线", "class":"")
|
,("field":"dStrike","name":"w:dstrike","obj":dStrike,"attrEx":"w:val","nodeType":"","attrName":"", "desc":"两个删除线", "class":"")
|
||||||
,("field":"kern","name":"w:kern","obj":kern,"attrEx":"w:val","nodeType":"","attrName":"", "desc":"字体紧排", "class":"")
|
,("field":"kern","name":"w:kern","obj":kern,"attrEx":"w:val","nodeType":"","attrName":"", "desc":"字体紧排", "class":"")
|
||||||
,("field":"Sz","name":"w:sz","obj":Sz,"attrEx":"w:val","nodeType":"","attrName":"", "desc":"字体大小", "class":"")
|
,("field":"Size","name":"w:sz","obj":Size,"attrEx":"w:val","nodeType":"","attrName":"", "desc":"字体大小", "class":"")
|
||||||
,("field":"szCs","name":"w:szCs","obj":szCs,"attrEx":"w:val","nodeType":"","attrName":"", "desc":"复杂脚本字体大小", "class":"")
|
,("field":"szCs","name":"w:szCs","obj":szCs,"attrEx":"w:val","nodeType":"","attrName":"", "desc":"复杂脚本字体大小", "class":"")
|
||||||
,("field":"U","name":"w:u","obj":U,"attrEx":"w:val","nodeType":"","attrName":"", "desc":"下划线", "class":"")
|
,("field":"U","name":"w:u","obj":U,"attrEx":"w:val","nodeType":"","attrName":"", "desc":"下划线", "class":"")
|
||||||
,("field":"vertAlign","name":"w:vertAlign","obj":vertAlign,"attrEx":"w:val","nodeType":"","attrName":"", "desc":"对齐方式.", "class":"")
|
,("field":"vertAlign","name":"w:vertAlign","obj":vertAlign,"attrEx":"w:val","nodeType":"","attrName":"", "desc":"对齐方式.", "class":"")
|
||||||
|
|
@ -5878,16 +5878,6 @@ type TwrPr=class(NodeInfo)
|
||||||
rFont.XMLhAnsi := nName;
|
rFont.XMLhAnsi := nName;
|
||||||
rFont.XMLascii := nName;
|
rFont.XMLascii := nName;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Property Size read readSize write writeSize;
|
|
||||||
Function writeSize(n);
|
|
||||||
Begin
|
|
||||||
Sz := n * 2;
|
|
||||||
End;
|
|
||||||
Function readSize();
|
|
||||||
Begin
|
|
||||||
return int(Sz / 2);
|
|
||||||
End;
|
|
||||||
|
|
||||||
//Attributes
|
//Attributes
|
||||||
|
|
||||||
|
|
@ -5901,7 +5891,7 @@ type TwrPr=class(NodeInfo)
|
||||||
Strike;
|
Strike;
|
||||||
dStrike;
|
dStrike;
|
||||||
kern;
|
kern;
|
||||||
Sz;
|
Size;
|
||||||
szCs;
|
szCs;
|
||||||
U;
|
U;
|
||||||
vertAlign;
|
vertAlign;
|
||||||
|
|
@ -12143,7 +12133,7 @@ private
|
||||||
cnt := length(data);
|
cnt := length(data);
|
||||||
//[err, axis] := ColumnNumberToName(2 * ind + 2);
|
//[err, axis] := ColumnNumberToName(2 * ind + 2);
|
||||||
[err, axis] := ColumnNumberToName(ind + 2);
|
[err, axis] := ColumnNumberToName(ind + 2);
|
||||||
Val.NumRef.F := format('Sheet1!$%s$2:$%s$%d', axis, axis, cnt+1);
|
Val.NumRef.F := fmt('Sheet1!${}$2:${}${}',axis, axis, cnt+1);
|
||||||
Val.NumRef.NumCache.PtCount := cnt;
|
Val.NumRef.NumCache.PtCount := cnt;
|
||||||
Val.NumRef.NumCache.formatCode := 'General';
|
Val.NumRef.NumCache.formatCode := 'General';
|
||||||
for i:=0 to cnt-1 do Begin
|
for i:=0 to cnt-1 do Begin
|
||||||
|
|
@ -12172,7 +12162,8 @@ private
|
||||||
else if istable(Categories) then Begin //word 图表
|
else if istable(Categories) then Begin //word 图表
|
||||||
cnt := length(Categories);
|
cnt := length(Categories);
|
||||||
//[err, axis] := ColumnNumberToName(2 * ind + 1);
|
//[err, axis] := ColumnNumberToName(2 * ind + 1);
|
||||||
cat.StrRef.F := format('Sheet1!$A$2:$A$%d', cnt+1);
|
//cat.StrRef.F := fmt('Sheet1!${}$2:${}${}',axis, axis, cnt+1);
|
||||||
|
cat.StrRef.F := fmt('Sheet1!$A$2:$A${}', cnt+1);
|
||||||
cat.StrRef.StrCache.PtCount := cnt;
|
cat.StrRef.StrCache.PtCount := cnt;
|
||||||
for i:=0 to cnt-1 do Begin
|
for i:=0 to cnt-1 do Begin
|
||||||
Tpt := TOfficeObj('Tpt');
|
Tpt := TOfficeObj('Tpt');
|
||||||
|
|
@ -13289,19 +13280,6 @@ Type TDocumentBody = Class(DocObject)
|
||||||
return array(length(errArr), tslFuncCount, errArr);
|
return array(length(errArr), tslFuncCount, errArr);
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Function RunTslCode(code, err);
|
|
||||||
Begin
|
|
||||||
try
|
|
||||||
//println('run code=[{}]', code);
|
|
||||||
if code <> '' then
|
|
||||||
eval(&code);
|
|
||||||
except
|
|
||||||
err := ExceptObject.ErrInfo;
|
|
||||||
return false;
|
|
||||||
End;
|
|
||||||
return true;
|
|
||||||
End;
|
|
||||||
|
|
||||||
Function ExecInnerTSLImpl(docx);
|
Function ExecInnerTSLImpl(docx);
|
||||||
Begin
|
Begin
|
||||||
tslFuncCount := 0;
|
tslFuncCount := 0;
|
||||||
|
|
@ -13435,14 +13413,13 @@ Type TDocumentBody = Class(DocObject)
|
||||||
TOfficeApi().Set('CodePage', 'gbk');
|
TOfficeApi().Set('CodePage', 'gbk');
|
||||||
try
|
try
|
||||||
tslFuncCount ++;
|
tslFuncCount ++;
|
||||||
|
println('run code=[{}]', code);
|
||||||
if code <> '' then
|
if code <> '' then
|
||||||
str := eval(&code);
|
eval(&code);
|
||||||
except
|
except
|
||||||
println('run code={},err={}', code, ExceptObject.ErrInfo);
|
println('run code={},err={}', code, ExceptObject.ErrInfo);
|
||||||
errArr[ length(errArr) ] := array('code':code, 'err':ExceptObject.ErrInfo);
|
errArr[ length(errArr) ] := array('code':code, 'err':ExceptObject.ErrInfo);
|
||||||
str := '';
|
|
||||||
End;
|
End;
|
||||||
tslFuncCount ++;
|
|
||||||
tNode := curRun.node_.FirstChildElement('w:t');
|
tNode := curRun.node_.FirstChildElement('w:t');
|
||||||
if not ifObj(tNode) then Begin //没有在外部插入文字
|
if not ifObj(tNode) then Begin //没有在外部插入文字
|
||||||
tslBegParagraphNode.DeleteChild(curRunNode);
|
tslBegParagraphNode.DeleteChild(curRunNode);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Version 1.3.5
|
// Version 1.3.0
|
||||||
|
|
||||||
Type TSDocxFile = Class
|
Type TSDocxFile = Class
|
||||||
///Version: V1.0 2022-09-20
|
///Version: V1.0 2022-09-20
|
||||||
|
|
@ -18,17 +18,7 @@ Type TSDocxFile = Class
|
||||||
Function Create(alias, fname); overload;
|
Function Create(alias, fname); overload;
|
||||||
Begin
|
Begin
|
||||||
init();
|
init();
|
||||||
OpenFile(alias, fname, nil);
|
OpenFile(alias, fname);
|
||||||
End;
|
|
||||||
|
|
||||||
///构造函数,打开已经存在的docx文件
|
|
||||||
///alias: string,文件目录别名
|
|
||||||
///fname: string,文件名
|
|
||||||
///passwd: string,密码
|
|
||||||
Function Create(alias, fname, passwd); overload;
|
|
||||||
Begin
|
|
||||||
init();
|
|
||||||
OpenFile(alias, fname, passwd);
|
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Function Destory();
|
Function Destory();
|
||||||
|
|
@ -44,12 +34,11 @@ Type TSDocxFile = Class
|
||||||
///打开docx文件
|
///打开docx文件
|
||||||
///alias: string,文件目录别名
|
///alias: string,文件目录别名
|
||||||
///fname: string,文件名
|
///fname: string,文件名
|
||||||
///[passwd]: string,密码
|
|
||||||
///返回:[err, errmsg]
|
///返回:[err, errmsg]
|
||||||
Function OpenFile(alias, fname, passwd);
|
Function OpenFile(alias, fname);
|
||||||
Begin
|
Begin
|
||||||
if not ifObj(zipfile_) then return array(-1, 'Create ZipFile object fail.');
|
if not ifObj(zipfile_) then return array(-1, 'Create ZipFile object fail.');
|
||||||
[err, errmsg] := zipfile_.Open(alias, fname, passwd);
|
[err, errmsg] := zipfile_.Open(alias, fname);
|
||||||
if err=0 then Begin
|
if err=0 then Begin
|
||||||
document_ := new docxDocument(zipfile_);
|
document_ := new docxDocument(zipfile_);
|
||||||
End;
|
End;
|
||||||
|
|
@ -67,12 +56,6 @@ Type TSDocxFile = Class
|
||||||
End;
|
End;
|
||||||
return array(err, errmsg);
|
return array(err, errmsg);
|
||||||
End;
|
End;
|
||||||
|
|
||||||
///设置密码
|
|
||||||
Function SetPassword(passwd)
|
|
||||||
Begin
|
|
||||||
zipfile_.Password := passwd;
|
|
||||||
End;
|
|
||||||
|
|
||||||
///保存文件
|
///保存文件
|
||||||
///返回: [err, info]
|
///返回: [err, info]
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Version 1.3.5
|
// Version 1.3.0
|
||||||
|
|
||||||
Type TSExcelFile = Class
|
Type TSExcelFile = Class
|
||||||
///Version: V1.0 2022-08-08
|
///Version: V1.0 2022-08-08
|
||||||
|
|
@ -18,17 +18,7 @@ Type TSExcelFile = Class
|
||||||
Function Create(alias, fname); overload;
|
Function Create(alias, fname); overload;
|
||||||
Begin
|
Begin
|
||||||
init();
|
init();
|
||||||
OpenFile(alias, fname, nil);
|
OpenFile(alias, fname);
|
||||||
End;
|
|
||||||
|
|
||||||
///构造函数,打开已经存在的excel文件
|
|
||||||
///alias: string,文件目录别名
|
|
||||||
///fname: string,文件名
|
|
||||||
///passwd: string,密码
|
|
||||||
Function Create(alias, fname, passwd); overload;
|
|
||||||
Begin
|
|
||||||
init();
|
|
||||||
OpenFile(alias, fname, passwd);
|
|
||||||
End;
|
End;
|
||||||
|
|
||||||
//析构函数
|
//析构函数
|
||||||
|
|
@ -45,13 +35,12 @@ Type TSExcelFile = Class
|
||||||
///打开excel文件
|
///打开excel文件
|
||||||
///alias: string,文件目录别名
|
///alias: string,文件目录别名
|
||||||
///fname: string,文件名
|
///fname: string,文件名
|
||||||
///[passwd]: string,密码
|
|
||||||
///返回: [err, errmsg]
|
///返回: [err, errmsg]
|
||||||
Function OpenFile(alias, fname, passwd);
|
Function OpenFile(alias, fname);
|
||||||
Begin
|
Begin
|
||||||
init();
|
init();
|
||||||
if not ifObj(zipfile_) then return array(-1, 'Create ZipFile object fail.');
|
if not ifObj(zipfile_) then return array(-1, 'Create ZipFile object fail.');
|
||||||
[err, errmsg] := zipfile_.Open(alias, fname, passwd);
|
[err, errmsg] := zipfile_.Open(alias, fname);
|
||||||
if err=0 then Begin
|
if err=0 then Begin
|
||||||
workbook_ := new xlsxWorkBook(zipfile_);
|
workbook_ := new xlsxWorkBook(zipfile_);
|
||||||
workbook_.Load();
|
workbook_.Load();
|
||||||
|
|
@ -80,12 +69,6 @@ Type TSExcelFile = Class
|
||||||
return zipfile_.Save();
|
return zipfile_.Save();
|
||||||
End;
|
End;
|
||||||
|
|
||||||
///设置密码
|
|
||||||
Function SetPassword(passwd)
|
|
||||||
Begin
|
|
||||||
zipfile_.Password := passwd;
|
|
||||||
End;
|
|
||||||
|
|
||||||
///打开二进制内容
|
///打开二进制内容
|
||||||
///data: 二进制数据
|
///data: 二进制数据
|
||||||
///返回: [err, errmsg]
|
///返回: [err, errmsg]
|
||||||
|
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
Function TOfficeInit();
|
|
||||||
Begin
|
|
||||||
sysparams['TOffice sys api'] := nil;
|
|
||||||
End;
|
|
||||||
|
|
@ -30,16 +30,16 @@ Type TDocxChart = Class(TSChart)
|
||||||
Function GetInnerXml();
|
Function GetInnerXml();
|
||||||
Begin
|
Begin
|
||||||
ETU := 360045;//1cm单位
|
ETU := 360045;//1cm单位
|
||||||
return format('<w:r>
|
return fmt('<w:r>
|
||||||
<w:drawing>
|
<w:drawing>
|
||||||
<wp:inline>
|
<wp:inline>
|
||||||
<wp:extent cx="%d" cy="%d"/>
|
<wp:extent cx="{}" cy="{}"/>
|
||||||
<wp:effectExtent l="0" t="0" r="19050" b="19050"/>
|
<wp:effectExtent l="0" t="0" r="19050" b="19050"/>
|
||||||
<wp:docPr id="%d" name="%s"/>
|
<wp:docPr id="{}" name="{}"/>
|
||||||
<wp:cNvGraphicFramePr />
|
<wp:cNvGraphicFramePr />
|
||||||
<a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">
|
<a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">
|
||||||
<a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/chart">
|
<a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/chart">
|
||||||
<c:chart xmlns:c="http://schemas.openxmlformats.org/drawingml/2006/chart" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" r:id="rId%d"/>
|
<c:chart xmlns:c="http://schemas.openxmlformats.org/drawingml/2006/chart" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" r:id="rId{}"/>
|
||||||
</a:graphicData>
|
</a:graphicData>
|
||||||
</a:graphic>
|
</a:graphic>
|
||||||
</wp:inline>
|
</wp:inline>
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ Type TSTag = Class
|
||||||
Begin
|
Begin
|
||||||
if not ifArray(map_) then Begin
|
if not ifArray(map_) then Begin
|
||||||
map_ := array();
|
map_ := array();
|
||||||
//println('attribute={}',attribute_);
|
println('attribute={}',attribute_);
|
||||||
arr := Str2Array(attribute_, ' ');
|
arr := Str2Array(attribute_, ' ');
|
||||||
for i := 0 to length(arr)-1 do Begin
|
for i := 0 to length(arr)-1 do Begin
|
||||||
kv := Str2Array(arr[i], '=');
|
kv := Str2Array(arr[i], '=');
|
||||||
|
|
|
||||||
|
|
@ -124,7 +124,7 @@ xmlns:v="urn:schemas-microsoft-com:vml">
|
||||||
if ifObj(node) then Begin
|
if ifObj(node) then Begin
|
||||||
[err, col, row] := excel_.CellNameToCoordinates(cell);
|
[err, col, row] := excel_.CellNameToCoordinates(cell);
|
||||||
clientData := TOfficeObj('TClientData');
|
clientData := TOfficeObj('TClientData');
|
||||||
clientData.Anchor := format('%d,23,%d,0,%d,%d,%d,5',col, row, 1+col+lineCount, colCount+col-1, 1+row+lineCount);
|
clientData.Anchor := fmt('{},23,{},0,{},{},{},5',col, row, 1+col+lineCount, colCount+col-1, 1+row+lineCount);
|
||||||
clientData.Row := row - 1;
|
clientData.Row := row - 1;
|
||||||
ClientData.Column := col - 1;
|
ClientData.Column := col - 1;
|
||||||
node.UnMarshal(clientData.Marshal());
|
node.UnMarshal(clientData.Marshal());
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,7 @@ private
|
||||||
name := "列" $ col_index++;
|
name := "列" $ col_index++;
|
||||||
excel_.WorkBook().SetCellValue(sheetName_, cell, name);
|
excel_.WorkBook().SetCellValue(sheetName_, cell, name);
|
||||||
end
|
end
|
||||||
table_str += format('<tableColumn id="%d" name="%s" />', id, name);
|
table_str += fmt('<tableColumn id="{}" name="{}" />', id++, name);
|
||||||
end
|
end
|
||||||
table_str += "</tableColumns>";
|
table_str += "</tableColumns>";
|
||||||
|
|
||||||
|
|
|
||||||
34
更新日志.md
34
更新日志.md
|
|
@ -1,39 +1,5 @@
|
||||||
# 更新日志
|
# 更新日志
|
||||||
|
|
||||||
## 2023-7-14
|
|
||||||
|
|
||||||
### V1.3.5
|
|
||||||
|
|
||||||
#### word
|
|
||||||
|
|
||||||
段落字体大小设置调整,对齐VBA设置
|
|
||||||
|
|
||||||
## 2023-7-11
|
|
||||||
|
|
||||||
### V1.3.4
|
|
||||||
|
|
||||||
修复加密Bug
|
|
||||||
|
|
||||||
## 2023-7-4
|
|
||||||
|
|
||||||
### V1.3.3
|
|
||||||
|
|
||||||
word/excel 新增加密方法`SetPassword`,升级`OpenFile(alias, fileName, Password)`
|
|
||||||
|
|
||||||
## 2023-6-26
|
|
||||||
|
|
||||||
### V1.3.2
|
|
||||||
|
|
||||||
修复.net使用rdo2执行失败问题,使用rdo2时候,需调用`TOfficeInit()`初始化
|
|
||||||
|
|
||||||
#### word
|
|
||||||
|
|
||||||
1. 修复word模板`template.docx`执行失败问题
|
|
||||||
|
|
||||||
## 2023-6-20
|
|
||||||
|
|
||||||
更新部署方式,不再依赖`fmt_pubkrnl_plugin.dll`,详情见[README](./README.md)
|
|
||||||
|
|
||||||
## 2023-4-26
|
## 2023-4-26
|
||||||
|
|
||||||
### V1.3.1
|
### V1.3.1
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue