F
Fernando Cabral
By doing
for i = 1 to activedocument.words(i).count
ActiveDocument.Words(i).Select
word(i).start = ActiveDocument.Words(i).start
word(i).end = ActiveDocument.Words(i).end
next i
I create an array with pointers to every word in a word document.
Problem: SLLLLLLOOOOOWWWWWW. It takes forever even for a "small"
document with (say) 300 pages.
I can do the same by first copying the whole text into a variable and then
tokening it. Say:
Dim s as string
s = activedocument.content.text
for i = 1 len(s)
word(i).start = NextToken(s).start
word(i).end = NextToken(s).end
next i
The second method is hundred times faster.
Problem arise when the document is not "plain" text. That is, it also contains
pictures, drawing, TOC, etc.
In this case each non-textual element adds an additional offset in the first
method, but not in the second. As we move towards the end of the text
the offset increases as we pass by each non-textual element.
Question: is there a way for me to get how many objects there are in the
text, where they are, how many bytes they take?
- fernando
for i = 1 to activedocument.words(i).count
ActiveDocument.Words(i).Select
word(i).start = ActiveDocument.Words(i).start
word(i).end = ActiveDocument.Words(i).end
next i
I create an array with pointers to every word in a word document.
Problem: SLLLLLLOOOOOWWWWWW. It takes forever even for a "small"
document with (say) 300 pages.
I can do the same by first copying the whole text into a variable and then
tokening it. Say:
Dim s as string
s = activedocument.content.text
for i = 1 len(s)
word(i).start = NextToken(s).start
word(i).end = NextToken(s).end
next i
The second method is hundred times faster.
Problem arise when the document is not "plain" text. That is, it also contains
pictures, drawing, TOC, etc.
In this case each non-textual element adds an additional offset in the first
method, but not in the second. As we move towards the end of the text
the offset increases as we pass by each non-textual element.
Question: is there a way for me to get how many objects there are in the
text, where they are, how many bytes they take?
- fernando