Using LINQ, I am trying to iterate through the list objects in Lists collection of Microsoft WORD. But I'm getting the following error on the Where
clause in the third line of my button click event below:
ERROR
List does not contain a definition for 'Where' and no accessible extension method 'Where' accepting a first argument of type 'List' could be found.
CODE
using System;
using MS_WORD = Microsoft.Office.Interop.Word;
using System.Linq;
....
private void BtnTest_Click(object sender, RoutedEventArgs e)
{
Application application = new Application();
Document document = application.Documents.Open("C:\\word.doc");
MS_WORD.Lists oLsts = document.Lists.Where(n => n..Range.ListFormat.ListType == Word.WdListType.wdListSimpleNumbering);
application.Quit();
}
References: