This commit is contained in:
csh 2023-07-14 10:33:49 +08:00
parent f34d03a50f
commit 845c6bb554
5 changed files with 44 additions and 26 deletions

View File

@ -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 := 48; p.Font.Size := 24;
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 := 32; preface.Font.Size := 16;
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 := 32; p1.Run.rPr.Size := 16;
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 := 32; p1.Run.rPr.Size := 16;
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 := 32; p1.Run.rPr.Size := 16;
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 := 30; help.Font.Size := 15;
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 := 16; p.Font.Size := 8;
p2 := footer.AddParagraph(p, -1, nil); p2 := footer.AddParagraph(p, -1, nil);
p.Font.Size := 18; p.Font.Size := 8;
pgno := footer.AddPageNumber('第 {0} 页,共 {1} 页', p.Font); //添加页码 pgno := footer.AddPageNumber('第 {-3} 页,共 {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 := 16; p.Font.Size := 8;
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 := 32; range.Font.Size := 16;
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 := 28; range1.Font.Size := 14;
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 := 28; range2.Font.Size := 14;
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 := 20; r.Font.Size := 10;
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 := 28; p.Font.Size := 14;
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 := 29; p.Font.Size := 15;
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 := 24; tbl.Format.Borders.Top.Size := 12;
tbl.Format.Borders.Left.Size := 24; tbl.Format.Borders.Left.Size := 12;
tbl.Format.Borders.Bottom.Size := 24; tbl.Format.Borders.Bottom.Size := 12;
tbl.Format.Borders.Right.Size := 24; tbl.Format.Borders.Right.Size := 12;
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 := 28; p.Font.Size := 14;
p.Font.Color := 'FF0000'; p.Font.Color := 'FF0000';
p.Font.Bold := true; p.Font.Bold := true;
p.Format.LeftIndent := 500;//段落左边距 p.Format.LeftIndent := 500;//段落左边距

View File

@ -1,4 +1,4 @@
// Version 1.3.4 // Version 1.3.5
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":"Size","name":"w:sz","obj":Size,"attrEx":"w:val","nodeType":"","attrName":"", "desc":"字体大小", "class":"") ,("field":"Sz","name":"w:sz","obj":Sz,"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":"")
@ -5879,6 +5879,16 @@ type TwrPr=class(NodeInfo)
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
//Nodes //Nodes
@ -5891,7 +5901,7 @@ type TwrPr=class(NodeInfo)
Strike; Strike;
dStrike; dStrike;
kern; kern;
Size; Sz;
szCs; szCs;
U; U;
vertAlign; vertAlign;

View File

@ -1,4 +1,4 @@
// Version 1.3.4 // Version 1.3.5
Type TSDocxFile = Class Type TSDocxFile = Class
///Version: V1.0 2022-09-20 ///Version: V1.0 2022-09-20

View File

@ -1,4 +1,4 @@
// Version 1.3.4 // Version 1.3.5
Type TSExcelFile = Class Type TSExcelFile = Class
///Version: V1.0 2022-08-08 ///Version: V1.0 2022-08-08

View File

@ -1,5 +1,13 @@
# 更新日志 # 更新日志
## 2023-7-14
### V1.3.5
#### word
段落字体大小设置调整对齐VBA设置
## 2023-7-11 ## 2023-7-11
### V1.3.4 ### V1.3.4