Word 2002 SP2, bug in searching table

D

David Waddell

Hi ,

I've found what I think to be a bug in the find object's wrap behaviour
when
applied in tables;

I'm using Word 2002 SP 2 on windows 2000 (Word Help-About shows version
10.4525.4219).
I've tun this test against word 2002, no service packs, and the bug is
not evident there.

The test, code to recreate below, involves a table with 1 row, 2 columns.
The first cell contains text
in Courier New font, the second in Arial. Executing a non-wrapping find on
the range of the second cell
for Arial font returns a match, incorrectly. The start and end positions of
the range searched on can be seen
to have jumped back to the first cell.

If any of you guys can point out that I'm doing something wrong, or shed
any more light on this,
would greatly appreciate it (It's busting our units tests ;)

Thanks,
David.


code :
using vb6,
I get the following output in my debug window :
finder.found is True
Range start,end are now 0,32
Original start,end was 33,60


Dim app As Word.Application
Dim doc As Word.Document
Dim table As Word.table
Dim range As Word.range
Dim rangeOrig As Word.range
Dim finder As Object

' open a new doc
Set app = New Word.Application
app.Visible = False
Set doc = app.Documents.Add

' add a table
Set range = doc.range(0, 0)
Set table = doc.Tables.Add(range, 1, 2)

' first cell text in Courier New
Set range = table.Cell(1, 1).range
range.Font.Name = "Courier New"
range.Text = "This text is in courier new font"

' second cell text in Arial
Set range = table.Cell(1, 2).range
range.Font.Name = "Arial"
range.Text = "This text is in arial font"

' search for courier new font in the second cell
Set range = table.Cell(1, 2).range
Set rangeOrig = range.Duplicate ' keeping a copy for diagnostics
below
Set finder = range.Find
finder.ClearFormatting
finder.Text = ""
finder.Wrap = Word.wdFindStop
finder.Forward = True
finder.Font.Name = "Courier New"
finder.Execute

' diagnostics :
Debug.Print "finder.found is " & finder.Found
If finder.Found Then
Debug.Print "Range start,end are now " & vbTab & range.start & "," &
range.End
Debug.Print "Original start,end was" & vbTab & rangeOrig.start & ","
& rangeOrig.End
End If
 
C

Cindy Meister -WordMVP-

Hi David,
I've tun this test against word 2002, no service packs, and the bug is
not evident there.
I don't have the configuration you mention set up, at the moment. But
FWIW I don't see the problem in Word 2003 beta, nor in Word 2000. This
seems to be something peculiar to the build you're testing on.

I'd open a support incident with Microsoft - if you can prove it's a bug
you won't be charged. I'd hope they could then get this fixed in an
SP...

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

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