v1.4.6-patch3

This commit is contained in:
csh 2023-09-21 09:22:15 +08:00
parent 493691b930
commit 5f1064794d
4 changed files with 1190 additions and 7 deletions

1169
Demo/DocxHelp.tsl Normal file

File diff suppressed because it is too large Load Diff

View File

@ -21,7 +21,7 @@ Type TDocxCopy = class
Function Copy(posOpt); Function Copy(posOpt);
Begin Begin
// 复制所有的样式 // 复制所有的样式
style_copy_obj_.CopyStyle(); style_copy_obj_.CopyStyle(number_copy_obj_);
parts := new_docx_obj_.Body().Parts(); parts := new_docx_obj_.Body().Parts();
pos := old_docx_obj_.GetPosNode(posOpt); pos := old_docx_obj_.GetPosNode(posOpt);
@ -222,7 +222,7 @@ private
begin begin
id := numpr.GetAttribute('w:val'); id := numpr.GetAttribute('w:val');
numberid := number_copy_obj_.CopyNumbering(id); numberid := number_copy_obj_.CopyNumbering(id);
numpr.SetAttribute('w:val', id); numpr.SetAttribute('w:val', numberid);
end end
DeleteComment(paragraph); // 删除批注 DeleteComment(paragraph); // 删除批注
End; End;
@ -326,11 +326,12 @@ Type TDocxStyleCopy = class
end end
End; End;
Function CopyStyle(); Function CopyStyle(numberobj);
Begin Begin
for id, obj in id_map_ do for id, obj in id_map_ do
begin begin
SetBasedOn(obj); SetBasedOn(obj);
SetNumId(obj, numberobj);
SetLink(obj); SetLink(obj);
old_style_obj_.CopyStyle(obj); old_style_obj_.CopyStyle(obj);
end; end;
@ -382,11 +383,23 @@ private
end end
End; End;
Function SetNumId(obj, numberobj);
Begin
if not ifObj(numberobj) then return;
numPr := class(TSXml).GetNode(obj.node_, 'w:pPr/w:numPr/w:numId');
if ifObj(numPr) then
begin
id := numpr.GetAttribute('w:val');
numberid := numberobj.CopyNumbering(id);
numpr.SetAttribute('w:val', numberid);
end
End;
Function GetNewName(name); Function GetNewName(name);
Begin Begin
new_name := name; new_name := name;
count := 0; count := 0;
while ifObj(old_style_obj_.GetStyle(new_name)) or style_name_map2_[new_name] do while ifObj(old_style_obj_.GetStyle(class(TSXml).Utf8ToCurCodePage(new_name))) or style_name_map2_[new_name] do
new_name := new_name $ count++; new_name := new_name $ count++;
return new_name; return new_name;
End; End;
@ -437,9 +450,9 @@ Type TDocxNumberCopy = class
begin begin
number_obj := old_number_obj_.CopyNumber(obj); number_obj := old_number_obj_.CopyNumber(obj);
id_map_[number] := number_obj; id_map_[number] := number_obj;
return number_obj;
end end
end; return id_map_[number];
end
End; End;
private private

View File

@ -8,6 +8,7 @@
1. 修复表格存在合并单元格,生成目录报错问题 1. 修复表格存在合并单元格,生成目录报错问题
2. 修复单元格添加run对象设置样式不生效问题 2. 修复单元格添加run对象设置样式不生效问题
3. 修复插入word后中文样式重复问题
### excel ### excel