|
|
|
@@ -1,4 +1,4 @@
|
|
|
|
|
// Version 1.4.6
|
|
|
|
|
// Version 1.4.7
|
|
|
|
|
|
|
|
|
|
Function TOfficeObj(n);
|
|
|
|
|
Begin
|
|
|
|
@@ -13922,25 +13922,21 @@ Type TDocumentBody = Class(DocObject)
|
|
|
|
|
p := new TParagraph(pNode);
|
|
|
|
|
//统计数字项目编号
|
|
|
|
|
numArr := array();
|
|
|
|
|
ilvl := -1;
|
|
|
|
|
numId := '';
|
|
|
|
|
numId := getNumPr('numId', docx, p);
|
|
|
|
|
ilvl := getNumPr('Level', docx, p);
|
|
|
|
|
if not ilvl then ilvl := 0;
|
|
|
|
|
if ifarray(numIds) then Begin
|
|
|
|
|
sectPr.Append(p);
|
|
|
|
|
numId := p.Format.NumPr.Value('numId');
|
|
|
|
|
lvlStr := p.Format.NumPr.Value('Level');
|
|
|
|
|
if not ifnil(numId) and not ifnil(lvlStr) then Begin
|
|
|
|
|
ilvl := Class(TSXml).SafeStrToIntDef(lvlStr, -1);
|
|
|
|
|
if ilvl >= 0 and ilvl < 10 then Begin
|
|
|
|
|
if not istable(numIds[numId]) then
|
|
|
|
|
numIds[numId] := array(0,0,0,0,0,0,0,0,0,0);
|
|
|
|
|
prev := numIds[numId, ilvl];
|
|
|
|
|
if prev then Begin
|
|
|
|
|
for i:=ilvl+1 to 9 do
|
|
|
|
|
numIds[numId, i] := 0;
|
|
|
|
|
End;
|
|
|
|
|
numIds[numId, ilvl]++;
|
|
|
|
|
numArr := numIds[numId];
|
|
|
|
|
if ilvl >= 0 and ilvl < 10 then Begin
|
|
|
|
|
if not istable(numIds[numId]) then
|
|
|
|
|
numIds[numId] := array(0,0,0,0,0,0,0,0,0,0);
|
|
|
|
|
prev := numIds[numId, ilvl];
|
|
|
|
|
if prev then Begin
|
|
|
|
|
for i:=ilvl+1 to 9 do
|
|
|
|
|
numIds[numId, i] := 0;
|
|
|
|
|
End;
|
|
|
|
|
numIds[numId, ilvl]++;
|
|
|
|
|
numArr := numIds[numId];
|
|
|
|
|
End;
|
|
|
|
|
End;
|
|
|
|
|
if bHeadList then Begin //统计大纲显示(目录)
|
|
|
|
@@ -13948,7 +13944,7 @@ Type TDocumentBody = Class(DocObject)
|
|
|
|
|
if styleId <> '' then Begin
|
|
|
|
|
obj := docx.StyleObject().GetStyleById(styleId);
|
|
|
|
|
if ifObj(obj) then Begin
|
|
|
|
|
level := obj.HeadingLevel();
|
|
|
|
|
level := getHeadingLevel(docx, obj);
|
|
|
|
|
iLevel := Class(TSXml).SafeStrToIntDef(level, -1);
|
|
|
|
|
if p.Text() <> "" and iLevel+1 >= UpperHeadingLevel and iLevel+1 <= LowerHeadingLevel then Begin
|
|
|
|
|
r[ind]['Level'] := strtoint(level);
|
|
|
|
@@ -13989,6 +13985,40 @@ Type TDocumentBody = Class(DocObject)
|
|
|
|
|
return r;
|
|
|
|
|
End;
|
|
|
|
|
|
|
|
|
|
Function getNumPr(field, docx, p);
|
|
|
|
|
Begin
|
|
|
|
|
value := p.Format.NumPr.Value(field);
|
|
|
|
|
if value then return value;
|
|
|
|
|
styleId := p.Format.Value('StyleId', 1);
|
|
|
|
|
return getFieldByStyle(field, docx, docx.StyleObject().GetStyleById(styleid));
|
|
|
|
|
End;
|
|
|
|
|
|
|
|
|
|
Function getFieldByStyle(field, docx, obj);
|
|
|
|
|
Begin
|
|
|
|
|
if not ifObj(obj) then return '';
|
|
|
|
|
numId := obj.pPr.numPr.Value(field);
|
|
|
|
|
if numId = '' then
|
|
|
|
|
begin
|
|
|
|
|
id := o.Value('BasedOn');
|
|
|
|
|
return getNumIdByStyle(docx, docx.StyleObject().GetStyleById(id));
|
|
|
|
|
end
|
|
|
|
|
return numId;
|
|
|
|
|
End;
|
|
|
|
|
|
|
|
|
|
Function getHeadingLevel(docx, obj);
|
|
|
|
|
Begin
|
|
|
|
|
if not ifObj(obj) then return '';
|
|
|
|
|
o := obj;
|
|
|
|
|
level := obj.HeadingLevel();
|
|
|
|
|
if level = '' then
|
|
|
|
|
begin
|
|
|
|
|
id := o.Value('BasedOn');
|
|
|
|
|
return getHeadingLevel(docx, docx.StyleObject().GetStyleById(id));
|
|
|
|
|
end
|
|
|
|
|
return level;
|
|
|
|
|
End;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Function getPictureMaxId();
|
|
|
|
|
Begin
|
|
|
|
|
id := 0;
|
|
|
|
|