c# - Find paragraphs by style in word 2010 using interop -


could point me in right direction, or show me how find paragraphs style name using word interop in c#.net.

try loop this:

using wn = microsoft.office.interop.word; //...         wn::application wordapp;         wordapp = new wn.application(); //...             wn.document worddoc = wordapp.documents.open(filename); //open document          list<string> selectedparagraphs = new list<string>();         for(int i=1;i<worddoc.paragraphs.count;i++) //numeration of paragraphs starts 1         {                 string wordp = worddoc.paragraphs[i].range.text; // paragraph text                 string words = ((wn.style)worddoc.paragraphs[i].get_style()).namelocal; //get paragraph style name                 if (words=="needed style")                 {                     selectedparagraphs.add(wordp);                 }         } 

Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -