diff --git a/Windows-X64/office_plugin.dll b/Windows-X64/office_plugin.dll index 9d3bbfb..022772e 100644 Binary files a/Windows-X64/office_plugin.dll and b/Windows-X64/office_plugin.dll differ diff --git a/funcext/TSOffice/TOfficeObj.tsf b/funcext/TSOffice/TOfficeObj.tsf index a71bae0..fe3c3ff 100644 --- a/funcext/TSOffice/TOfficeObj.tsf +++ b/funcext/TSOffice/TOfficeObj.tsf @@ -1,4 +1,4 @@ -// Version 1.3.3 +// Version 1.3.4 Function TOfficeObj(n); Begin diff --git a/funcext/TSOffice/TSDocxFile.tsf b/funcext/TSOffice/TSDocxFile.tsf index 92317c3..7be65e1 100644 --- a/funcext/TSOffice/TSDocxFile.tsf +++ b/funcext/TSOffice/TSDocxFile.tsf @@ -1,4 +1,4 @@ -// Version 1.3.3 +// Version 1.3.4 Type TSDocxFile = Class ///Version: V1.0 2022-09-20 @@ -18,7 +18,17 @@ Type TSDocxFile = Class Function Create(alias, fname); overload; Begin init(); - OpenFile(alias, fname); + OpenFile(alias, fname, nil); + End; + + ///构造函数,打开已经存在的docx文件 + ///alias: string,文件目录别名 + ///fname: string,文件名 + ///passwd: string,密码 + Function Create(alias, fname, passwd); overload; + Begin + init(); + OpenFile(alias, fname, passwd); End; Function Destory(); @@ -34,11 +44,12 @@ Type TSDocxFile = Class ///打开docx文件 ///alias: string,文件目录别名 ///fname: string,文件名 + ///[passwd]: string,密码 ///返回:[err, errmsg] - Function OpenFile(alias, fname); + Function OpenFile(alias, fname, passwd); Begin if not ifObj(zipfile_) then return array(-1, 'Create ZipFile object fail.'); - [err, errmsg] := zipfile_.Open(alias, fname); + [err, errmsg] := zipfile_.Open(alias, fname, passwd); if err=0 then Begin document_ := new docxDocument(zipfile_); End; @@ -56,6 +67,12 @@ Type TSDocxFile = Class End; return array(err, errmsg); End; + + ///设置密码 + Function SetPassword(passwd) + Begin + if not ifnil(passwd) then zipfile_.Password := passwd; + End; ///保存文件 ///返回: [err, info] diff --git a/funcext/TSOffice/TSExcelFile.tsf b/funcext/TSOffice/TSExcelFile.tsf index 9389f3e..354e19e 100644 --- a/funcext/TSOffice/TSExcelFile.tsf +++ b/funcext/TSOffice/TSExcelFile.tsf @@ -1,4 +1,4 @@ -// Version 1.3.3 +// Version 1.3.4 Type TSExcelFile = Class ///Version: V1.0 2022-08-08 @@ -18,7 +18,17 @@ Type TSExcelFile = Class Function Create(alias, fname); overload; Begin init(); - OpenFile(alias, fname); + OpenFile(alias, fname, nil); + End; + + ///构造函数,打开已经存在的excel文件 + ///alias: string,文件目录别名 + ///fname: string,文件名 + ///passwd: string,密码 + Function Create(alias, fname, passwd); overload; + Begin + init(); + OpenFile(alias, fname, passwd); End; //析构函数 @@ -35,12 +45,13 @@ Type TSExcelFile = Class ///打开excel文件 ///alias: string,文件目录别名 ///fname: string,文件名 + ///[passwd]: string,密码 ///返回: [err, errmsg] - Function OpenFile(alias, fname); + Function OpenFile(alias, fname, passwd); Begin init(); if not ifObj(zipfile_) then return array(-1, 'Create ZipFile object fail.'); - [err, errmsg] := zipfile_.Open(alias, fname); + [err, errmsg] := zipfile_.Open(alias, fname, passwd); if err=0 then Begin workbook_ := new xlsxWorkBook(zipfile_); workbook_.Load(); @@ -69,6 +80,12 @@ Type TSExcelFile = Class return zipfile_.Save(); End; + ///设置密码 + Function SetPassword(passwd) + Begin + if not ifnil(passwd) then zipfile_.Password := passwd; + End; + ///打开二进制内容 ///data: 二进制数据 ///返回: [err, errmsg] diff --git a/更新日志.md b/更新日志.md index 52d085b..74c9f71 100644 --- a/更新日志.md +++ b/更新日志.md @@ -1,5 +1,11 @@ # 更新日志 +## 2023-7-4 + +### V1.3.3 + +word/excel 新增加密方法`SetPassword`,升级`OpenFile(alias, fileName, Password)` + ## 2023-6-26 ### V1.3.2