hi, im using current Telerik WPF Q1 2015 and also try using current and i have a problem in my project with DocumentTextSearch. the function is to load document xaml template and find text string and replace with table. but i have problem with DocumentTextSearch when searching text string from RadDocument its keep hanging when try to find text string. my code is like bellow :
public void ReplaceTable(ref RadDocument doc, string searchitem, Table RefTable)
{
doc.BeginUpdate();
try
{
using (DocumentPosition startFindPosition = new DocumentPosition(doc.DocumentLayoutBox, true))
{
var found = true;
while (found)
{
DocumentTextSearch textSearch = new DocumentTextSearch(doc);
TextRange find = textSearch.Find( Regex.Escape(searchitem), startFindPosition);
found = find != null;
if (found)
{
startFindPosition.MoveToPosition(find.EndPosition);
startFindPosition.AnchorToNextFormattingSymbol();
doc.CaretPosition.MoveToPosition(find.StartPosition);
find.SetSelection(doc);
//doc.Delete(false);
//doc.IncreaseLeftIndent();
//if (RefTable.Rows.Count == 1)
//{
// doc.Insert("-");
//}
//else
//{
// doc.InsertTable(RefTable);
//}
doc.Selection.Clear();
startFindPosition.RemoveAnchorFromNextFormattingSymbol();
}
}
}
}
catch (Exception e) { }
finally
{
doc.EndUpdate();
}
}
i wait your reply