function WordBoxIndexAtCharIndex(const Words: TPdfWordBoxes; CharIndex: Integer): Integer;
| Words | TPdfWordBoxes |
| CharIndex | Integer |
IntegerWordBoxIndexAtCharIndex returns the zero-based word-box index whose StartIndex and Count contain the requested character index, or -1 when no word matches
Use the result to choose which TPdfWordBox should be highlighted or selected as a TTS cursor advances
-1 when CharIndex is outside every word rangeIndex := WordBoxIndexAtCharIndex(Words, PdfView1.CurrentCharIndex);
if Index >= 0 then
PdfView1.SelectWordBox(Words[Index]);