Products | Support | Email a link to this topic. | Send comments on this topic. | Back to Introduction - All Topics | Help Version 19.0.4.3
|
Leadtools.Documents Namespace > DocumentPageText Class : BuildWords Method |
public void BuildWords()
'Declaration
Public Sub BuildWords()
'Usage
Dim instance As DocumentPageText instance.BuildWords()
public void buildWords()
public: void BuildWords();
The text words are created from the characters found in the document based on the IsEndOfWord returned by document parsing engine. Whenever an "end of word" is found, the last set of characters are grouped together and stored as an item in the Words list. This is not performed automatically, instead, you must call BuildWords to populate the Words list from the Characters.
The following explains how this method works. If the page text consists of the following string Hello World
, then the text parser engine will populate Characters as follows (ignoring Bounds):
Index | Code | IsEndOfWord | IsEndOfLine | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | H | false | false | 1 | e | false | false | 2 | l | false | false | 3 | l | false | false | 4 | o | true | false | 5 | W | false | false | 6 | o | false | false | 7 | r | false | false | 8 | l | false | false | 9 | d | true | true |
BuildWords will loop through each character till an item with IsEndOfWord equals to true is reached, it will then create a word from the characters found so far, in this case from index 0 to 4. The characters are combined into DocumentWord.Value (The string Hello
) and the union of these characters position and location (DocumentCharacter.Bounds) are set into DocumentWord.Bounds. The first index (0) and the last index (4) are set into DocumentWord.FirstCharacterIndex and DocumentWord.LastCharacterIndex.
The method then continues to the next character (index 5) and repeat the operation, this time using indices 5 and 9 and the result is DocumentWord with DocumentWord.Value set to World
, FirstCharacterIndex set to 5 and LastCharacterIndex set to 9.
For more information, refer to Parsing Text with the Documents Library.
For an example, refer to DocumentPageText.