Support MSWord Search

This commit is contained in:
Rich 2009-03-28 22:29:52 +00:00
parent 7693a9a034
commit fe2cd765f0
2 changed files with 22 additions and 2 deletions

View File

@ -8,6 +8,7 @@ using System.Windows.Forms;
using VEPROMS.CSLA.Library;
using Volian.Controls.Library;
using System.Reflection;
using LBWordLibrary;
namespace Volian.Controls.Library
@ -26,6 +27,12 @@ namespace Volian.Controls.Library
private DSOFile _DSOFile;
#endregion
#region Public Properties
private String _SearchString;
public String SearchString
{
get { return _SearchString; }
set { _SearchString = value; FindSearchString(); }
}
/// <summary>
/// Count of DSO Pages open. Limited to 18 in DisplayTabControl
/// </summary>
@ -131,6 +138,8 @@ namespace Volian.Controls.Library
this.Leave += new EventHandler(DSOTabPanel_Leave);
//this.GotFocus += new EventHandler(DSOTabPanel_GotFocus);
//this.LostFocus += new EventHandler(DSOTabPanel_LostFocus);
Application.DoEvents();
FindSearchString();
}
catch (Exception ex)
{
@ -140,7 +149,16 @@ namespace Volian.Controls.Library
// TODO: Should try to do a direct open using Word.
}
}
public void FindSearchString()
{
// Get the Document
LBDocumentClass wordDoc = new LBDocumentClass(_MyDSOFramer.ActiveDocument);
//LBSelection sel = wordDoc.Application.Selection;
LBFind find = wordDoc.Application.Selection.Find;
find.ClearFormatting();
bool wildCards = SearchString.Contains("?") || SearchString.Contains("*");
Console.WriteLine("find = {0}", find.Execute(SearchString, false, false, wildCards, false, false, true, LBWdFindWrap.wdFindContinue,null,null,null,false,false,false,false));
}
private string ShowException(Exception ex)
{
string sep = "\r\n ";

View File

@ -612,7 +612,9 @@ namespace Volian.Controls.Library
if (_ItemInfo != null)
{
_OpenDocFromSearch = true;
_TabControl.OpenItem(_ItemInfo); // open the corresponding procedure text
DisplayTabItem dti = _TabControl.OpenItem(_ItemInfo); // open the corresponding procedure text
if (dti.MyDSOTabPanel != null)
dti.MyDSOTabPanel.SearchString = this.cbxTextSearchText.Text;
_OpenDocFromSearch = false;
}
}