Re: How can I know current insert position? by huh
huh
Tue Mar 13 20:32:05 CDT 2007
My boss order to me ;-(, make addin that count characters between start to
current insert position periodically.
characters mean 'characters(with space)' value in statistic dialog that is
built-in Word 2007.
"Jezebel" wrote:
> You need to define your terms. Range.Count includes a lot of things that you
> wouldn't want to count as characters: eg paragraph marks, end-of-cell
> markers in tables, field codes, etc. What are you actually trying to count,
> for what purpose?
>
> What's wrong with Range.Characters.Count?
>
>
>
>
>
> "huh" <huh@discussions.microsoft.com> wrote in message
> news:FB0D0323-AD95-4378-95BA-18A4A919F4B5@microsoft.com...
> > Thanks a lot Jezebel. It's working.
> >
> > In addition, I add next routibe to confirm insert position.
> >
> > if(Selection.Type == Word.WdSelectionType.wdSelectionIP) {
> > currentEnd = Selection.End;
> > }
> >
> > But I think 'Range.Count' property is something wrong. It count everything
> > between start and end range.(If I make [2,2] table - table is blank -,
> > count
> > property increse 6. If I add image, count property increse.)
> >
> > I have used 'Range.ComputeStatistics()'. It was accuracy more than
> > Range.Count but more slow and insert position in Word is dismised. ;)
> >
> > Somebody know more accuracy and fast method to count characters?
> >
> > "Jezebel" wrote:
> >
> >> The current cursor position is the Selection object. So the 'cursor
> >> position' you want is presumably is Selection.Start. The number of
> >> characters in the document up to the cursor is given by
> >>
> >> ActiveDocument.Range(0, Selection.Start).Characters.Count
> >>
> >>
> >>
> >>
> >>
> >>
> >> "huh" <huh@discussions.microsoft.com> wrote in message
> >> news:D2EBA9E3-4860-4CEC-AE13-EE19B7216B9E@microsoft.com...
> >> > I'm programing character count addin. It count from document start to
> >> > current
> >> > insert position (cursor position) not document end.
> >> >
> >> > Does it exist api - get current insert/cursor position?
> >>
> >>
> >>
>
>
>