This commit is contained in:
csh 2024-01-31 17:39:37 +08:00
parent 522e52ed46
commit 6d6281229c
4 changed files with 12 additions and 8 deletions

View File

@ -1,4 +1,4 @@
// Version 1.5.8 // Version 1.5.9
Function TOfficeObj(n); Function TOfficeObj(n);
Begin Begin
case lowercase(n) of case lowercase(n) of

View File

@ -1,4 +1,4 @@
// Version 1.5.8 // Version 1.5.9
Type TSDocxFile = Class Type TSDocxFile = Class
///Version: V1.0 2022-09-20 ///Version: V1.0 2022-09-20
///适用于 Microsoft Word docx格式文件 ///适用于 Microsoft Word docx格式文件
@ -49,7 +49,7 @@ Type TSDocxFile = Class
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.');
if zipfile_.FilesCount() > 0 then zipfile_ := new ZipFile(); if zipfile_.FilesCount() > 0 then zipfile_ := new ZipFile();
[err, errmsg] := zipfile_.Open(alias, fname, passwd); [err, errmsg] := zipfile_.Open(alias, TOfficeApi().CurCodePageToGBK(fname), passwd);
if err=0 then Begin if err=0 then Begin
document_ := new docxDocument(zipfile_); document_ := new docxDocument(zipfile_);
End; End;
@ -87,7 +87,7 @@ Type TSDocxFile = Class
///返回: [err, info] ///返回: [err, info]
Function SaveAs(alias, fname); Function SaveAs(alias, fname);
Begin Begin
return zipfile_.Save(alias, fname); return zipfile_.Save(alias, TOfficeApi().CurCodePageToGBK(fname));
End; End;
///另存为二进制流数据 ///另存为二进制流数据

View File

@ -1,4 +1,4 @@
// Version 1.5.8 // Version 1.5.9
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 等多种文档格式。
@ -45,7 +45,7 @@ Type TSXlsxFile = Class
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.');
if zipfile_.FilesCount() > 0 then zipfile_ := new ZipFile(); if zipfile_.FilesCount() > 0 then zipfile_ := new ZipFile();
[err, errmsg] := zipfile_.Open(alias, fname, passwd); [err, errmsg] := zipfile_.Open(alias, TOfficeApi().CurCodePageToGBK(fname), passwd);
if err=0 then InitVars(); if err=0 then InitVars();
return array(err, errmsg); return array(err, errmsg);
End; End;
@ -96,7 +96,7 @@ Type TSXlsxFile = Class
///返回: [err, info] ///返回: [err, info]
Function SaveAs(alias, fname); Function SaveAs(alias, fname);
Begin Begin
return zipfile_.Save(alias, fname); return zipfile_.Save(alias, TOfficeApi().CurCodePageToGBK(fname));
End; End;
///真实文件名 ///真实文件名

View File

@ -1,6 +1,10 @@
# 更新日志 # 更新日志
## 2023-1-18 ## 2023-1-31
### V1.5.9
修复`tsl`脚本格式为`utf8`时无法打开中文命名的文件
### V1.5.8 ### V1.5.8