private string abstarctRichBoxString(string keyWord, Application testWord) //暂定private testDoc提取richBox内容 { testWord.Selection.Find.Text = keyWord; //查询的文字 string s = ""; string previous = ""; string now = ""; Selection currentSelect = testWord.Selection; WdInformation pageNum = WdInformation.wdActiveEndAdjustedPageNumber; WdInformation rowNum = WdInformation.wdFirstCharacterLineNumber; while (testWord.Selection.Find.Execute()) { object page = currentSelect.get_Information(pageNum); object row = currentSelect.get_Information(rowNum); previous = now; now = currentSelect.Paragraphs[1].Range.Text.Trim(); list.Add(page); list.Add(row); if (!now.Equals(previous)) { s += page + "页" + row + "行 " + now + "\r\r"; } } testWord.Selection.HomeKey(WdUnits.wdStory, Type.Missing); return(s); }
/// <summary> /// Returns the Information object from the given object. /// </summary> /// <param name="obj">Object to retrieve information object from</param> /// <param name="type">Information type to retrieve</param> /// <returns>Information object</returns> private object information(object obj, WdInformation type) { if (isAvailable && obj != null) { return(obj.GetType().InvokeMember("Information", BindingFlags.GetProperty, null, obj, new object[1] { (int)type })); } return(null); }
private object Information(object obj, WdInformation type) { if (this.IsAvailable && __WordType != null && obj != null) { return(__WordType.InvokeMember("Information", BindingFlags.GetProperty, null, obj, new object[1] { (int)type })); } return(null); }
/// <summary> /// Returns the Information object from the given object. /// </summary> /// <param name="obj">Object to retrieve information object from</param> /// <param name="type">Information type to retrieve</param> /// <returns>Information object</returns> /// <history> /// [Curtis_Beard] 07/28/2006 Created /// </history> private object Information(object obj, WdInformation type) { if (IsAvailable && obj != null) return obj.GetType().InvokeMember("Information", BindingFlags.GetProperty, null, obj, new object[1] { (int)type }); return null; }