Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Long Documents / January 2006

Tip: Looking for answers? Try searching our database.

Problem to find format in word 2003

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
VN - 03 Jan 2006 17:48 GMT
I'm using the FIND object to find formats (Format=TRUE, FinText = ""). My
problem is that in WORD 2003 the method execute to aplied to a find object
return FALSE and i don´t can obtain the new range.
In word 2000 i don´t have this problems the method return TRUE and all is
OK. I'm using the API of word 2003 and the problems continues...

Thank's you.
Klaus Linke - 04 Jan 2006 21:59 GMT
Can you post the code? How is .Wrap set? Maybe you aren't searching in the
Range you think you are searching (... if you set a breakpoint and select
the range, that should be easy to check)?

Regards,
Klaus

> I'm using the FIND object to find formats (Format=TRUE, FinText = "").
> My problem is that in WORD 2003 the method execute to aplied to a
[quoted text clipped - 3 lines]
>
> Thank's you.
VN - 05 Jan 2006 08:28 GMT
For example with this text: 'This is a text (style bold) with formating.'

Range range(Par.GetRange());
Characters caract(range.GetCharacters());

Range car = caract.Item(longcar);

Find buscar(car.GetFind());
                       
COleVariant FindText;
FindText = "";
COleVariant MatchCase;
MatchCase = (short)FALSE;
COleVariant MatchWholeWord;
MatchWholeWord = (short)FALSE;
COleVariant MatchWildcards;
MatchWildcards = (short)FALSE;
COleVariant MatchSoundsLike;
MatchSoundsLike = (short)FALSE;
COleVariant MatchAllWordForms;
MatchAllWordForms = (short)FALSE;
COleVariant Forward;
Forward = (short)TRUE;
COleVariant Wrap;
Wrap = (short)wdFindStop;
COleVariant Format;
Format = (short)TRUE;
COleVariant ReplaceWith;
ReplaceWith = "";
COleVariant Replace;
Replace = (short)wdReplaceNone;

BOOL resul = buscar.Execute(
        &FindText,
        &MatchCase,
        &MatchWholeWord,
        &MatchWildcards,
        &MatchSoundsLike,
        &MatchAllWordForms,
        &Forward,
        &Wrap,
        &Format,
        &ReplaceWith,
        &Replace);

if the document is in word 2000 resul = TRUE and the function
car.GetText() return the string 'his is a text ' and all is ok, but if the
document is save with word 2002 0r 2003, resul = FALSE and the funtion
car.GetText() return the char 't' .....

Regards,
VN.

"Klaus Linke" escribió:

> Can you post the code? How is .Wrap set? Maybe you aren't searching in the
> Range you think you are searching (... if you set a breakpoint and select
[quoted text clipped - 10 lines]
> >
> > Thank's you.
Klaus Linke - 09 Jan 2006 01:23 GMT
It's unlikely that there is a new bug in Find... Maybe something else is
going wrong?
Are you sure the document is opened as a formatted document, and not as a
text file (i.e., can you see the file when it's opened)?

There have been some changes in the VBA for opening files from 2000 to
2002/2003, but no changes in Find that I am aware of.

BTW, maybe better collapse the range before the search? Your code depends on
the fact that Word skips the Range if it completely matches the search
criteria, and immediately continues searching downwards. It may be better to
make the code independent of such things.

Regards,
Klaus

"VN" schrieb:
> For example with this text: 'This is a text (style bold) with formating.'
>
[quoted text clipped - 66 lines]
>> >
>> > Thank's you.
Tony Jollans - 09 Jan 2006 11:09 GMT
Where in this code are you saying that you want to find Bold text?

The Find object is persistent. When you don't specify something explicitly,
any previous setting remains in effect.

You should always be explicit in code, and need to add "Find.Font.Bold =
True" (or the equivalent in whatever language this is) to the execution.

--
Enjoy,
Tony

> For example with this text: 'This is a text (style bold) with formating.'
>
[quoted text clipped - 65 lines]
> > >
> > > Thank's you.
VN - 10 Jan 2006 11:52 GMT
But i need to find i change of style (not only bold... underline,....) and
with the flag Format = (short)TRUE; and FindText = "";  i think that is
enought. In word 2000 runs ok but in word 2002 or 2003 is wrong; maybe in the
open is the different i'm tested that the document is open  as a formatted
document....

Thanks.

"Tony Jollans" escribió:

> Where in this code are you saying that you want to find Bold text?
>
[quoted text clipped - 80 lines]
> > > >
> > > > Thank's you.

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.