Click here to Skip to main content
15,867,838 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi Friends,
I have task to collect the specific word paragraphs and insert the bookmark for paragraphs range.

What I have tried:

C#
// 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.
Posted
Updated 4-Jun-18 2:46am
Comments
Maciej Los 4-Jun-18 6:57am    
What is exact error message?

1 solution

The syntax in the ForEach should be:

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

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900