遍历paragraph时快速越过table的算法思考
产生一组Range对象集合
以表格为间隔,产生多个Range对象
使用时,遍历Range对象集合
在Range对象中再遍历操作
基于for(i)遍历Paragraph/ListParagraph跳过
如果是表格
判断表格中的Paragraph/ListParagraph数量
for(i)中的i+表格中paragraph数量
//ListParagraph:
#region [基于for(i)遍历Paragraph/ListParagraph跳过]遍历paragraph时快速越过table的算法思考-成功-2022年4月30日18:32:55
if ((bool)selectionRange.ListParagraphs[i].Range.Information[Word.WdInformation.wdWithInTable])
{
//确保在表格中的第一个Paragraph/ListParagraph处进行累加。且确保累加后的不再在之前的表中
i = i + selectionRange.ListParagraphs[i].Range.Tables[1].Range.ListParagraphs.Count - 1;//减1是因为for处还得自增量+1
continue;
//提醒:进度条需要由原来的[PerformStep()]改成[Value]模式。//基于快速越过table算法,所以改成i
}
#endregion
//Paragraph:
#region [基于for(i)遍历Paragraph/ListParagraph跳过]遍历paragraph时快速越过table的算法思考-成功-2022年4月30日18:32:55
if ((bool)selectionRange.Paragraphs[i].Range.Information[Word.WdInformation.wdWithInTable])
{
//确保在表格中的第一个Paragraph/ListParagraph处进行累加。且确保累加后的不再在之前的表中
i = i + selectionRange.Paragraphs[i].Range.Tables[1].Range.Paragraphs.Count - 1;//减1是因为for处还得自增量+1
continue;
//提醒:进度条需要由原来的[PerformStep()]改成[Value]模式。//基于快速越过table算法,所以改成i
}
#endregion
计算公式正确性识别: