I am using the following code to find some strings in my document:
Application application = Addin.Application;
Document document = application.ActiveDocument;
Range rng = document.Content;
rng.Find.ClearFormatting();
rng.Find.Forward = true;
rng.Find.Text = findText;
while (rng.Find.Execute() && rng.Find.Found)
{
// here this is always rng.TextVisibleOnScreen == -1
}
According to the documentation:
The TextVisibleOnScreen property returns 1 if all text in the range is visible; it returns 0 if no text in the range is visible; and it returns -1 if some text in the range is visible and some is not. Text that is not visible could be, for example, text that is in a collapsed heading.
However the property is always -1
even when the text is not on the screen at all or when all the text is on the screen... Is this a known issue? Am I doing something wrong?