我有一個MS Word文檔看起來像這樣 找到MS Word表格包含一個特定文本
現在我想找到這表包含短語「/ CCID_ntRow /」。正如您從文檔結構中看到的那樣,它是第二個表格。但是每循環一次,Find.Execute的返回都會返回true。 這裏是我的代碼:
int whichTable = 1; //starting index is 1, not 0
do {
doc.Tables[whichTable].Range.Find.ClearFormatting();
doc.Tables[whichTable].Range.Find.Wrap = MSWord.WdFindWrap.wdFindContinue;
doc.Tables[whichTable].Range.Find.Text = "/CCID_ntRow/";
doc.Tables[whichTable].Range.Select();
isFound = doc.Tables[whichTable].Range.Find.Execute(ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing);
if (isFound == true) {
//everytime, isFound returns true. The right must be 2
break;
}
whichTable++;
} while (true);
請幫我解決這個問題。預先感謝您