This commit is contained in:
csh 2025-01-07 10:56:24 +08:00
parent 3243db0e2d
commit 3c16ce510a
4 changed files with 54 additions and 7 deletions

View File

@ -1,4 +1,4 @@
// Version 1.7.4 // Version 1.7.5
Function TOfficeObj(n); Function TOfficeObj(n);
Begin Begin
case lowercase(n) of case lowercase(n) of
@ -13004,6 +13004,16 @@ Type TDocumentBody = Class(DocObject)
Begin Begin
return getDocumentObjects(node_, ''); return getDocumentObjects(node_, '');
End; End;
///返回文档中Sdt
Function Sdts();
Begin
parts := getDocumentObjects(node_, 'w:sdt');
r := array();
for i:=0 to length(parts)-1 do
r[i] := new TSdt(parts[i].node_);
return r;
End;
///word文档所有段落 ///word文档所有段落
///返回TParagraph对象数组 ///返回TParagraph对象数组
@ -14599,6 +14609,22 @@ private
maxId_; maxId_;
End; End;
//w:sdt
Type TSdt = Class(TDocumentBody)
Function Create(node);overload;
Begin
Class(TDocumentBody).Create(node.FirstChild('w:sdtContent'));
Create(node, 'w:sdt');
End;
Function Create(node, name);overload;
Begin
name_ := name;
End;
name_;
End;
//w:tc //w:tc
Type TCell = Class(TDocumentBody, TWTc) Type TCell = Class(TDocumentBody, TWTc)
Function Create();overload; Function Create();overload;

View File

@ -1,4 +1,4 @@
// Version 1.7.4 // Version 1.7.5
Type TSDocxFile = Class Type TSDocxFile = Class
///Version: V1.0 2022-09-20 ///Version: V1.0 2022-09-20
///适用于 Microsoft Word docx格式文件 ///适用于 Microsoft Word docx格式文件
@ -266,6 +266,13 @@ Type TSDocxFile = Class
Begin Begin
return document_.Body().Sections(index); return document_.Body().Sections(index);
End; End;
///获取Structured Document Tag
///返回TSdt集合
Function Sdts();
Begin
return document_.Body().Sdts();
End;
///添加章节 ///添加章节
///sessionTDocSection对象 ///sessionTDocSection对象

View File

@ -1,4 +1,4 @@
// Version 1.7.4 // Version 1.7.5
Type TSXlsxFile = Class Type TSXlsxFile = Class
///Version: V1.0 2022-08-08 ///Version: V1.0 2022-08-08
///适用于 Microsoft Excel? 2007 及以上版本创建的电子表格文档。支持 XLSX / XLSM / XLTM / XLTX 等多种文档格式。 ///适用于 Microsoft Excel? 2007 及以上版本创建的电子表格文档。支持 XLSX / XLSM / XLTM / XLTX 等多种文档格式。

View File

@ -1,10 +1,24 @@
# 更新日志 # 更新日志
## 2025-1-7
### V1.7.5
#### word
1. 支持获取`sdt`标签类型的内容(如文本框),通过`TSDocxFile.Sdts()`获取文档的的所有`sdt`
> ```pascal
> sdts := docx.Sdts();
> paragraphs := sdts[0].Paragraphs();
> textbox := paragraphs[1].TextBoxs();
> ```
## 2024-12-23 ## 2024-12-23
### V1.7.4 ### V1.7.4
### word #### word
1. `insertfile`时候默认添加`w16du`命名空间 1. `insertfile`时候默认添加`w16du`命名空间
@ -14,7 +28,7 @@
#### word #### word
1. `insertfile`支持ole对象的插入如wmf公式excel表格 1. `insertfile`支持 ole 对象的插入,如 wmf 公式excel 表格
## 2024-12-04 ## 2024-12-04
@ -30,8 +44,8 @@
#### word #### word
1. 对生成目录的xml结构进行更改 1. 对生成目录的 xml 结构进行更改
2. 修复引用excel错误 2. 修复引用 excel 错误
#### excel #### excel