整合页眉页脚代码

This commit is contained in:
csh
2024-08-21 15:41:08 +08:00
parent 4357cfb529
commit 70ad4acbdb
7 changed files with 268 additions and 593 deletions
+26
View File
@@ -6,6 +6,8 @@ public
function GetDocumentRelsAdapter(): RelationShipsAdapter;
function GetNumberingWare(): TSNumberingWare;
function GetTblStylePrByType(style_id: string; type: string): TblStylePr;
function GetFtr(target: string): Ftr;
function GetHdr(target: string): Hdr;
private
styles_deserialize_flag_;
@@ -13,12 +15,16 @@ private
document_rels_adapter_;
numbering_ware_;
tbl_style_pr_hash_;
ftr_hash_;
hdr_hash_;
end;
function TSDocxComponentsWare.Create();
begin
class(Components).Create();
tbl_style_pr_hash_ := array();
ftr_hash_ := array();
hdr_hash_ := array();
end;
function TSDocxComponentsWare.GetStyles(): Styles;
@@ -63,3 +69,23 @@ begin
tbl_style_pr_hash_[style_id][type] := tbl_style_pr;
return tbl_style_pr;
end;
function TSDocxComponentsWare.GetFtr(target: string): Ftr;
begin
if ftr_hash_[target] then return ftr_hash_[target];
index := replaceStr(replaceStr(target, "header", ""), ".xml", "");
obj := {self.}Headers(strtoint(index));
obj.Deserialize();
ftr_hash_[target] := obj;
return obj;
end;
function TSDocxComponentsWare.GetHdr(target: string): Hdr;
begin
if hdr_hash_[target] then return hdr_hash_[target];
index := replaceStr(replaceStr(target, "header", ""), ".xml", "");
obj := {self.}Footers(strtoint(index));
obj.Deserialize();
hdr_hash_[target] := obj;
return obj;
end;