I have used code from one of your examples on regex returning an array of textselections as follows...
System.Text.RegularExpressions.Regex regx = new System.Text.RegularExpressions.Regex(@"\{\{[^{}]+\}\}");
Spire.Doc.Documents.TextSelection[] textSelections = document.FindAllPattern(regx);
The problem I am having is that during the processing of each one of these, a few of these (half way through the collection)
are giving me errors "Index and length must refer to a location within the string"
here is the looping code
for (int x = (textSelections.Length - 1); x >= 0; x--)
{
Spire.Doc.Documents.TextSelection selection = textSelections[x];
try
{
string val = selection.GetAsOneRange().Text; <-- error thrown by this line...
val = "<SPAN class=ip5 >" + val + "</SPAN>";
selection.GetAsOneRange().Text = val;
}
catch (Exception ex)
{ return ex.Message }
}
When I try to figure out why it is doing this, I get nowhere as I have no way of accessing the data inside....could I get a hand please?