如何使用linq插入带有paragarph集合列表的书签? [英] How to insert bookmark with list of paragarph collection using linq?

查看:135
本文介绍了如何使用linq插入带有paragarph集合列表的书签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友们,

我有收集特定单词段落的任务,并插入段落范围的书签。



我尝试过:



Hi Friends,
I have task to collect the specific word paragraphs and insert the bookmark for paragraphs range.

What I have tried:

// numParaList is List<Word.Paragraph> numParaList = new List<Word.Paragraph>();
if(numParaList.Count>0)
            {
                int bmNum = 1;
                numParaList.ForEach(Function(x) wDoc.Bookmarks.Add("para_Number_" + bmNum++.ToString(), x.Range));

            }





但它显示错误,任何人都有更好的解决方案。



but it shows the error, anyone have the better solution for this.

推荐答案

ForEach中的语法应为:



The syntax in the ForEach should be:

numParaList.ForEach(x => wDoc.Bookmarks.Add("para_Number_" + bmNum++.ToString(), x.Range));


这篇关于如何使用linq插入带有paragarph集合列表的书签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆