v1.8.2
This commit is contained in:
parent
ca03e53285
commit
a2c3905cd0
|
|
@ -1,4 +1,4 @@
|
||||||
// Version 1.8.1
|
// Version 1.8.2
|
||||||
Function TOfficeObj(n);
|
Function TOfficeObj(n);
|
||||||
Begin
|
Begin
|
||||||
case lowercase(n) of
|
case lowercase(n) of
|
||||||
|
|
@ -11143,17 +11143,34 @@ Type TParagraph = Class(DocObject, TParagraphImpl)
|
||||||
Begin
|
Begin
|
||||||
if ifObj(node_) then
|
if ifObj(node_) then
|
||||||
begin
|
begin
|
||||||
if ifObj(node_.FirstChildElement("w:r")) then return false;
|
|
||||||
sub_node := node_.FirstChildElement();
|
sub_node := node_.FirstChildElement();
|
||||||
if not ifObj(sub_node) then return true;
|
if not ifObj(sub_node) then return true;
|
||||||
// 兼容wps
|
|
||||||
sub_node2 := sub_node.NextElement();
|
sub_node2 := sub_node.NextElement();
|
||||||
if sub_node.GetName() = 'w:bookmarkStart' and ifObj(sub_node2) and sub_node2.GetName() = 'w:bookmarkEnd' then
|
|
||||||
return true;
|
sub_node_name := sub_node.GetName();
|
||||||
|
if sub_node_name = "w:r" then
|
||||||
|
begin
|
||||||
|
r_sub_node := sub_node.FirstChildElement();
|
||||||
|
if not ifObj(r_sub_node) then return true;
|
||||||
|
while ifObj(r_sub_node) do
|
||||||
|
begin
|
||||||
|
sub_node2_name := r_sub_node.GetName();
|
||||||
|
if sub_node2_name = 'w:t' and trim(r_sub_node.GetText()) <> '' then return fasle;
|
||||||
|
else if sub_node2_name in array('mc:AlternateContent', 'w:drawing', 'w:pict', 'w:object') then return false;
|
||||||
|
r_sub_node := r_sub_node.NextElement();
|
||||||
|
end
|
||||||
|
end
|
||||||
// 兼容word
|
// 兼容word
|
||||||
if sub_node.GetName() = 'w:pPr' and not ifObj(sub_node2) then
|
else if sub_node_name = 'w:pPr' and not ifObj(sub_node2) then
|
||||||
|
begin
|
||||||
return true;
|
return true;
|
||||||
end
|
end
|
||||||
|
// 兼容wps
|
||||||
|
else if sub_node_name = 'w:bookmarkStart' and ifObj(sub_node2) and sub_node2.GetName() = 'w:bookmarkEnd' then
|
||||||
|
begin
|
||||||
|
return true;
|
||||||
|
end
|
||||||
|
end
|
||||||
return false;
|
return false;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
|
|
@ -14144,7 +14161,7 @@ Type TDocumentBody = Class(DocObject)
|
||||||
r[ind]['numId'] := arr[ii]['numId'];
|
r[ind]['numId'] := arr[ii]['numId'];
|
||||||
r[ind]['ilvl'] := arr[ii]['ilvl'];
|
r[ind]['ilvl'] := arr[ii]['ilvl'];
|
||||||
r[ind]['numArr'] := arr[ii]['numArr'];
|
r[ind]['numArr'] := arr[ii]['numArr'];
|
||||||
ind++
|
ind++;
|
||||||
end
|
end
|
||||||
End;
|
End;
|
||||||
End;
|
End;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Version 1.8.1
|
// Version 1.8.2
|
||||||
Type TSDocxFile = Class
|
Type TSDocxFile = Class
|
||||||
///Version: V1.0 2022-09-20
|
///Version: V1.0 2022-09-20
|
||||||
///适用于 Microsoft Word docx格式文件
|
///适用于 Microsoft Word docx格式文件
|
||||||
|
|
@ -113,7 +113,10 @@ Type TSDocxFile = Class
|
||||||
///返回:string
|
///返回:string
|
||||||
Function FileName();
|
Function FileName();
|
||||||
Begin
|
Begin
|
||||||
return zipfile_.FileName();
|
file_name := zipfile_.FileName();
|
||||||
|
if TOfficeApi().IsUtf8() then
|
||||||
|
return AnsiToUTF8(file_name);
|
||||||
|
return file_name;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
///word文档所有段落
|
///word文档所有段落
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Version 1.8.1
|
// Version 1.8.2
|
||||||
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 等多种文档格式。
|
||||||
|
|
@ -103,7 +103,10 @@ Type TSXlsxFile = Class
|
||||||
///返回: string
|
///返回: string
|
||||||
Function FileName();
|
Function FileName();
|
||||||
Begin
|
Begin
|
||||||
return zipfile_.FileName();
|
file_name := zipfile_.FileName();
|
||||||
|
if TOfficeApi().IsUtf8() then
|
||||||
|
return AnsiToUTF8(file_name);
|
||||||
|
return file_name;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
///获取工作表列表
|
///获取工作表列表
|
||||||
|
|
|
||||||
|
|
@ -1610,9 +1610,9 @@ private
|
||||||
Function copyFile(obj, target, content);
|
Function copyFile(obj, target, content);
|
||||||
Begin
|
Begin
|
||||||
file_name := ReplaceStr(target, '..', 'xl');
|
file_name := ReplaceStr(target, '..', 'xl');
|
||||||
counts := GetFilesCount(ReplaceStrByReg(file_name, "\\d+.*ml", '')) + 1;
|
counts := GetFilesCount(ReplaceStrUsingReg(file_name, "\\d+.*ml", '')) + 1;
|
||||||
xml := GetXmlFileObj(file_name);
|
xml := GetXmlFileObj(file_name);
|
||||||
new_file_postfix := ReplaceStrByReg(file_name[3:], "\\d+", inttostr(counts));
|
new_file_postfix := ReplaceStrUsingReg(file_name[3:], "\\d+", inttostr(counts));
|
||||||
zipfile_.Add('xl' + new_file_postfix, xml.Data());
|
zipfile_.Add('xl' + new_file_postfix, xml.Data());
|
||||||
obj.SetAttribute('Target', '..' + new_file_postfix);
|
obj.SetAttribute('Target', '..' + new_file_postfix);
|
||||||
|
|
||||||
|
|
@ -1624,6 +1624,17 @@ private
|
||||||
return array(counts, 'xl' + new_file_postfix);
|
return array(counts, 'xl' + new_file_postfix);
|
||||||
End;
|
End;
|
||||||
|
|
||||||
|
function ReplaceStrUsingReg(s, regFromText, toText);
|
||||||
|
begin
|
||||||
|
ParseCtrls := 'r';
|
||||||
|
if ifnil(toText) then toText := '';
|
||||||
|
ParseRegExpr(RegFromText,s,ParseCtrls,toText,s2);
|
||||||
|
if ansicontainstext(ParseCtrls,'r') then //表替换,输出s2
|
||||||
|
return ifstring(s2)?s2:s;
|
||||||
|
else
|
||||||
|
return ifArray(toText) and length(toText) > 0 ? toText : array();
|
||||||
|
end;
|
||||||
|
|
||||||
sheetsCount_:integer;
|
sheetsCount_:integer;
|
||||||
sheetNames_;
|
sheetNames_;
|
||||||
sheetIndexMap_;
|
sheetIndexMap_;
|
||||||
|
|
|
||||||
18
更新日志.md
18
更新日志.md
|
|
@ -1,5 +1,19 @@
|
||||||
# 更新日志
|
# 更新日志
|
||||||
|
|
||||||
|
## 2025-10-29
|
||||||
|
|
||||||
|
### V1.8.2
|
||||||
|
|
||||||
|
### word
|
||||||
|
|
||||||
|
1. 升级段落判空`Empty`
|
||||||
|
2. 修复`FileName`总是返回 gbk
|
||||||
|
|
||||||
|
### excel
|
||||||
|
|
||||||
|
1. 修复`CopySheet`依赖的`ReplaceStrByReg`公共方法问题,不再依赖该方法
|
||||||
|
2. 修复`FileName`总是返回 gbk
|
||||||
|
|
||||||
## 2025-7-22
|
## 2025-7-22
|
||||||
|
|
||||||
### V1.8.1
|
### V1.8.1
|
||||||
|
|
@ -41,13 +55,13 @@ docx.AddParagraph(p, -1);
|
||||||
#### word
|
#### word
|
||||||
|
|
||||||
1. **feat**:支持目录自定义宽度`TOfficeApi().Get("TTableContent-tab-position")`
|
1. **feat**:支持目录自定义宽度`TOfficeApi().Get("TTableContent-tab-position")`
|
||||||
2. **fix**:插入图片id计算错误,导致`office 2016 16.0.4266`版本不兼容
|
2. **fix**:插入图片 id 计算错误,导致`office 2016 16.0.4266`版本不兼容
|
||||||
|
|
||||||
## 2025-1-22
|
## 2025-1-22
|
||||||
|
|
||||||
### V1.7.8
|
### V1.7.8
|
||||||
|
|
||||||
❗解决`TSDocxFile`和`TSXlsxFile`内存泄露
|
❗ 解决`TSDocxFile`和`TSXlsxFile`内存泄露
|
||||||
|
|
||||||
#### word
|
#### word
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue