@@ -1,4 +1,4 @@
// Version 1.7.8
// Version 1.7.9
Type TSDocxFile = Class
///Version: V1.0 2022-09-20
///适用于 Microsoft Word docx格式文件
@@ -123,7 +123,7 @@ Type TSDocxFile = Class
return document_.Body().Paragraphs();
End;
///word文档最后一个段落
///word文档最后一个段落
///返回:TParagraph对象
Function LastParagraph();
Begin
@@ -237,7 +237,7 @@ Type TSDocxFile = Class
///tbl: TTable对象
///posOpt: 段落位置,0 在DOCX文件开头;-1 文件尾;N 在第N段之后;XmlNode节点对象或DocObject对象 在posOpt之后新添加表格
///customCell: 二维数组,自定义指定单元格的样式
/// 如:一行一列arr[0][0] := array(twtcPr, twpPr, twrPr);其中twtcPr是twtcPr对象,twpPr是twpPr对象,twrPr是twrPr对象
/// 如:一行一列arr[0][0] := array(twtcPr, twpPr, twrPr);其中twtcPr是twtcPr对象,twpPr是twpPr对象,twrPr是twrPr对象
///返回: TTable对象
Function InsertTable(tbl, posOpt, customCell);
Begin
@@ -267,12 +267,12 @@ Type TSDocxFile = Class
return document_.Body().Sections(index);
End;
///获取Structured Document Tag
///返回:TSdt集合
Function Sdts();
Begin
///获取Structured Document Tag
///返回:TSdt集合
Function Sdts();
Begin
return document_.Body().Sdts();
End;
End;
///添加章节
///session: TDocSection对象
@@ -607,16 +607,20 @@ Type TSDocxFile = Class
DocPrId_ := 0;
ps := Paragraphs();
for i:=0 to length(ps)-1 do Begin
node := class(TSXml).GetNode(ps[i].node_, 'w:r/w:drawing/wp:inline/wp:docPr' );
if not ifObj(node) then
node := class(TSXml).GetNode(p s[i ].node_, 'w:r/w:pict/v:shape/v:textbox/w:txbxContent /wp:docPr');
if not ifObj(node) then
node := class(TSXml).GetNode(p s[i ].node_, 'w:r/mc:AlternateContent/mc:Choice/w: drawing/wp:anchor/wp:docPr');
if ifObj(node) then Begin
id := class(TSXml).SafeStrToIntDef(node.GetAttribute('id'), 0 );
if id > DocPrId_ then
DocPrId_ := id ;
break;
runs := ps[i].GetRuns( );
for j:=0 to length(runs)-1 do Begin
node := class(TSXml).GetNode(run s[j ].node_, 'w:drawing/wp:inline /wp:docPr');
if not ifObj(node) then
node := class(TSXml).GetNode(run s[j ].node_, 'w:drawing/wp:anchor/wp:docPr');
if not ifObj(node) then
node := class(TSXml).GetNode(runs[j].node_, 'w:pict/v:shape/v:textbox/w:txbxContent/wp:docPr' );
if not ifObj(node) then
node := class(TSXml).GetNode(runs[j].node_, 'mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/wp:docPr') ;
if ifObj(node) then Begin
id := class(TSXml).SafeStrToIntDef(node.GetAttribute('id'), 0);
if id > DocPrId_ then
DocPrId_ := id;
End;
End;
End;
End;