Added InsertText method

This commit is contained in:
John Jenko 2009-08-24 16:33:24 +00:00
parent 8115aa071d
commit c8bbc9e228

View File

@ -160,6 +160,21 @@ namespace Volian.Controls.Library
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));
}
/// <summary>
/// Text will either replace current selection or be inserted at the current cursor position if no selection
/// </summary>
/// <param name="txt"></param>
public void InsertText(string txt)
{
if (txt == null || txt.Length == 0) return; //nothing to insert
// Get the Document
LBDocumentClass wordDoc = new LBDocumentClass(_MyDSOFramer.ActiveDocument);
//This will get the selected range or just the current cursor position
LBSelection sel = wordDoc.Application.Selection;
// This will replace the selection or insert at current position
sel.Text = txt;
}
private string ShowException(Exception ex)
{
string sep = "\r\n ";