Type TSDocxListFormatRange = Class(TSDocxListFormat) Uses TSDocxEnumerations; public Function Init(docx, rangeObj); Function Apply();override; private Function CallFunction(pf, value);overload; Function CallFunction(pf);overload; private paragraph_arr_; public // Methods Function ApplyBulletDefault(DefaultListBehavior);override; Function ApplyListTemplate(ListTemplate, ContinuePreviousList, ApplyTo, DefaultListBehavior);override; Function ApplyListTemplateWithLevel(ListTemplate, ContinuePreviousList, ApplyTo, DefaultListBehavior, ApplyLevel);override; Function ApplyNumberDefault(DefaultListBehavior);override; Function ApplyOutlineNumberDefault(DefaultListBehavior);override; Function CanContinuePreviousList(ListTemplate);override; Function ConvertNumbersToText();override; Function ListIndent();override; Function ListOutdent();override; Function RemoveNumbers(NumberType);override; // Properties Function ReadSingleListTemplate();override; Function ReadSingleList();override; Function ReadListValue();override; Function ReadListType();override; Function ReadListTemplate();override; Function ReadListString();override; Function ReadListPictureBullet();override; Function WriteListLevelNumber(value);override; Function ReadListLevelNumber();override; Function ReadList();override; End; // ============== 实现 ================= // Function TSDocxListFormatRange.Init(docx, rangeObj); Begin class(TSDocxListFormat).Init(docx, nil); paragraph_arr_ := sselect distinct(["tparagraph"]) from rangeObj.data_ end; End; Function TSDocxListFormatRange.Apply();override; Begin CallFunction(ThisFunction(class(TSDocxListFormat).Apply), nil); End; Function TSDocxListFormatRange.CallFunction(pf, value);overload; Begin for i:=0 to length(paragraph_arr_)-1 do begin pr_ := paragraph_arr_[i].pPr; if not ifObj(pr_.Root()) then continue; ##pf(value); end End; Function TSDocxListFormatRange.CallFunction(pf);overload; Begin ret := nil; for i:=0 to length(paragraph_arr_)-1 do begin pr_ := paragraph_arr_[i].pPr; if not ifObj(pr_.Root()) then continue; cur := ##pf(); if ifnil(ret) then ret := cur; if ret <> cur then return TSDocxEnumerations.wdUndefined(); end return ret; End; // Methods Function TSDocxListFormatRange.ApplyBulletDefault(DefaultListBehavior);override; Begin CallFunction(ThisFunction(class(TSDocxListFormat).ApplyBulletDefault), DefaultListBehavior); End; Function TSDocxListFormatRange.ApplyListTemplate(ListTemplate, ContinuePreviousList, ApplyTo, DefaultListBehavior);override; Begin End; Function TSDocxListFormatRange.ApplyListTemplateWithLevel(ListTemplate, ContinuePreviousList, ApplyTo, DefaultListBehavior, ApplyLevel);override; Begin End; Function TSDocxListFormatRange.ApplyNumberDefault(DefaultListBehavior);override; Begin CallFunction(ThisFunction(class(TSDocxListFormat).ApplyNumberDefault), DefaultListBehavior); End; Function TSDocxListFormatRange.ApplyOutlineNumberDefault(DefaultListBehavior);override; Begin CallFunction(ThisFunction(class(TSDocxListFormat).ApplyOutlineNumberDefault), DefaultListBehavior); End; Function TSDocxListFormatRange.CanContinuePreviousList(ListTemplate);override; Begin CallFunction(ThisFunction(class(TSDocxListFormat).CanContinuePreviousList), ListTemplate); End; Function TSDocxListFormatRange.ConvertNumbersToText();override; Begin return CallFunction(ThisFunction(class(TSDocxListFormatRange).ConvertNumbersToText)); End; Function TSDocxListFormatRange.ListIndent();override; Begin return CallFunction(ThisFunction(class(TSDocxListFormatRange).ListIndent)); End; Function TSDocxListFormatRange.ListOutdent();override; Begin return CallFunction(ThisFunction(class(TSDocxListFormatRange).ListOutdent)); End; Function TSDocxListFormatRange.RemoveNumbers(NumberType);override; Begin CallFunction(ThisFunction(class(TSDocxListFormat).RemoveNumbers), NumberType); End; Function TSDocxListFormatRange.ReadSingleListTemplate();override; Begin return CallFunction(ThisFunction(class(TSDocxListFormatRange).ReadSingleListTemplate)); End; Function TSDocxListFormatRange.ReadSingleList();override; Begin return CallFunction(ThisFunction(class(TSDocxListFormatRange).ReadSingleList)); End; Function TSDocxListFormatRange.ReadListValue();override; Begin return CallFunction(ThisFunction(class(TSDocxListFormatRange).ReadListValue)); End; Function TSDocxListFormatRange.ReadListType();override; Begin return CallFunction(ThisFunction(class(TSDocxListFormatRange).ReadListType)); End; Function TSDocxListFormatRange.ReadListTemplate();override; Begin return CallFunction(ThisFunction(class(TSDocxListFormatRange).ReadListTemplate)); End; Function TSDocxListFormatRange.ReadListString();override; Begin return CallFunction(ThisFunction(class(TSDocxListFormatRange).ReadListString)); End; Function TSDocxListFormatRange.ReadListPictureBullet();override; Begin return CallFunction(ThisFunction(class(TSDocxListFormatRange).ReadListPictureBullet)); End; Function TSDocxListFormatRange.WriteListLevelNumber(value);override; Begin CallFunction(ThisFunction(class(TSDocxListFormatRange).WriteListLevelNumber), Value); End; Function TSDocxListFormatRange.ReadListLevelNumber();override; Begin return CallFunction(ThisFunction(class(TSDocxListFormatRange).ReadListLevelNumber)); End; Function TSDocxListFormatRange.ReadList();override; Begin return CallFunction(ThisFunction(class(TSDocxListFormatRange).ReadList)); End;