problem with selecting range including an object

S

selim baþtürk

hi,
in a word document i find the occurence of 1.) , then the occurance of 2.)
and want to select everything within them.

int sno=wd.Content.Text.IndexOf("1.)",0);

int Ano=wd.Content.Text.IndexOf("2.)",0);

object s=sno;

object a = Ano;

MessageBox.Show(wd.Range(ref s,ref a).Text);



if there is no object between the occurences of 1.) and 2.) no problem, BUT
when there is an object (a bitmap or a clipart picture) between them, range
contains upto the object and several more characters, but not up to 2.)
Also, there is not a "2.)" occurence in rtf code of the object too...

does anyone know why can this happen? how can i fix that?!?
 
S

selim baþtürk

i discovered something strange while inserting objects:
on a blank document i insert a mathtype equetion and select it, then display
the selection.range's start and end : 0-27

then i insert a bitmap on a blank document and select it, it shows 0-26

then i insert an excel chart on a blank document and select it, it shows
0-28

why why why ? how can i solve this?
 
C

Cindy M -WordMVP-

Hi Selim,

I think you'll find the explanation of the numbers if you experiment with the
Range.TextRetrievalMode. Word uses FIELDS to insert objects into the text, and
if you don't set TextRetrievalMode to ignore field codes, these will be picked
up.
i discovered something strange while inserting objects:
on a blank document i insert a mathtype equetion and select it, then display
the selection.range's start and end : 0-27

then i insert a bitmap on a blank document and select it, it shows 0-26

then i insert an excel chart on a blank document and select it, it shows
0-28

why why why ? how can i solve this?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top