comjas.blogg.se

Microsoft word advanced find code
Microsoft word advanced find code













}while (findRange. If (!string.IsNullOrWhiteSpace(findRange.Text))īreak /*no need to find anymore for this page*/ *If found data is visible by human eyes*/ *Set the find range is the current page range*/į = (Word.WdColor)color Choose Edit > Find > Advanced Find and Replace (brings up the Advanced Find and Replace dialog box) Switch to the Replace tab Enter two spaces in the Find. *The last page: nStart will equal nEnd*/ *Get the start and end position of the current page*/ Object Which = .WdGoToDirection.wdGoToAbsolute Int color = 696969 //The color you can get by read the Font.Color of the Range in Debug view Int nTotalPage = oDoc.ComputeStatistics(PagesCountStat) This article to get the page range (the code is pretty unclean, but usable) This article to find out that must use instead of This article to find out how to loop the find next feature. Execute find -> Loop until not found anymore

microsoft word advanced find code

Get the range of the whole word document Net has this Find.Execute method, but I don't know if it's possible to do this, I have googled around but no hope.īut my idea is like this code using I have a problem like this: I need to use advanced find to find a specific text (base on Font of the text, the text string, wildcard.), and write down to a notepad file which page did I find that text.















Microsoft word advanced find code