Nevron Open Vision Documentation
Range Elements

All text elements except table column derive from the NRangeTextElement class. This class provides a system for indexing text content inside text root elements (document, header and footer). This indexing allows you to identify text elements that correspond to a particular text position, by assigning a unique index to each character, image, formatting instruction, etc. inside a particular root element. This allows you to think about text content as if it is a simple string.



Each range text element has a property called Range which allow you to get the range of positions spanned by a particular text element. For example consider the following code:

Copy Code
NSection section = new NSection();

NParagraph paragraph = new NParagraph();

NTextInline lowerCaps1 = new NTextInline("lower case text ");
NTextInline upperCaps = new NTextInline("UPPER CASE TEXT");
NTextInline lowerCaps2 = new NTextInline(" lower case text");





Note that the last line of code selects the range spanned by the inline containing upper caps. This results in the following text output:

In this particular example the value of the Range property of the upper caps inline is [16, 30]. This is because the inline element before it contains 16 characters and the upper caps inline itself is 15 chars long.

Blocks elements have ranges that encompass the content of all their descendant inline elements - for example the Range property of the paragraph defined in the above example is [0, 47]. This is how it's calculated:

- lowerCaps1 - [0, 15]

- upperCaps - [16, 30]

- lowerCaps2 - [31, 46]

- paragraph end [47, 47]

Intrinsic inline elements participate in the range indexing.



Send Feedback