- Code: Select all
TextSelection[] text = document.FindAllString("Universal Pulseless Arrest", false, true);
if (text == null)
{
continue;
}
foreach (TextSelection ts in text)
{
Debug.Print("Found text hit for " + textToMaps.Key);
TextRange tr = ts.GetAsOneRange();
}
Output:
Found text hit for Universal Pulseless Arrest
Found text hit for Universal Pulseless Arrest
Exception thrown: 'System.NullReferenceException' in Spire.Doc.dll
An unhandled exception of type 'System.NullReferenceException' occurred in Spire.Doc.dll
Object reference not set to an instance of an object.
On the command line:
Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
at Spire.Doc.Documents.TextSelection.GetAsOneRange(Boolean IsCopyFormat)
at Spire.Doc.Documents.TextSelection.GetAsOneRange()