Added InsertText method
This commit is contained in:
parent
8115aa071d
commit
c8bbc9e228
@ -160,6 +160,21 @@ namespace Volian.Controls.Library
|
|||||||
bool wildCards = SearchString.Contains("?") || SearchString.Contains("*");
|
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));
|
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)
|
private string ShowException(Exception ex)
|
||||||
{
|
{
|
||||||
string sep = "\r\n ";
|
string sep = "\r\n ";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user