Conditional hyphens can cause Word 2007 SP1 Find & Replace to hang


J

Jay Schlackman

I have been dealing with an interesting problem one of my users brought to me
which I believe has exposed a bug that has appeared in Word 2007 with SP1.


SUMMARY:
Documents containing conditional hyphens can cause Word to hang and consume
100% CPU when using the Find or Find & Replace command.


VERSIONS FOUND AFFECTED:
Word 2007 SP1
Specific build tested Microsoft Office Word 2007 (12.0.6212.1000) SP1 MSO
(12.0.6213.1000) running on Vista Enterprise, Vista Enterprise SP1 RC v.688,
and XP Professional SP2

VERSIONS NOT AFFECTED:
Word 2003 (SP1 and SP2)
Word 2007 (No SP)

VERSIONS UNTESTED:
All other versions.


REPRODUCIBLE: 100% with identified versions.


STEPS TO REPRODUCE:

1. Open the identified affected version of Word.

2. (Optional for readability, does not affect test case) On the Home tab, in
the Paragraph group, click Show/Hide to show formatting marks.

3. Type the word "Test"

4. Press the Enter key

5. Press the Tab key

6. Press the Enter key

7. Press Ctrl+- (Control + Hyphen) twice.

8. Press the Enter key

9. On the Home tab, in the Editing group, click Replace.

10. For 'Find what', enter "Test", and for 'Replace with', enter "Testing"

11. Click Replace All.

12. Observe that Word stops responding. Task Manager can be used to verify
that Word is consuming as much CPU as possible (up to 100%)



BACKGROUND:

The user had a number of documents that she frequently re-used by opening an
existing document, executing a Find & Replace > Replace All on a name in the
document, and saving the modified file as a new document. We recently
released Office 2007 SP1 through our WSUS server, and since then, the user
had found that her normal Find & Replace method was causing Word to hang and
consume 100% CPU, until Word was forcibly terminated using Task Manager.

After some investigation, I found that this behaviour can be reproduced when
you have more than 1 consecutive conditional hyphen in the document at any
point AFTER some other non-printing character (tested with tab and page
break), and the Find function is used to the point where it passes the
conditional hyphens. So, if Find All or Replace All is used, it will fail
immediately, or if the single Find or Replace commands are used, it will fail
as soon as it tries to search beyond the conditional hyphens.

In this case, the conditional hyphens had been entered accidentally,
possibly years ago given the amount of time the user has been producing these
documents. Removing them corrected her problem.

So far I have found this behaviour is only exhibited in Word 2007 SP1. I
can't say for certain that I've narrowed it down completely; other
non-printing characters may trigger this other than tab and page break,
possibly other characters than conditional hyphens will trigger it too, but
the above test case works for me every time.

I'd appreciate any input anyone can give!

----------------
This post is a suggestion for Microsoft, and Microsoft responds to the
suggestions with the most votes. To vote for this suggestion, click the "I
Agree" button in the message pane. If you do not see the button, follow this
link to open the suggestion in the Microsoft Web-based Newsreader and then
click "I Agree" in the message pane.

http://www.microsoft.com/office/com...9&dg=microsoft.public.word.application.errors
 
Ad

Advertisements

B

Bob Buckland ?:-\)

Hi Jay,

Using MS Office Word 2007 SP1 on Windows XP SP2 I repeated the steps you gave and did not have a hang.

If you start Word in safe mode (holding ctrl key when clicking on the Word shortcut icon) do you get the same result?

Are there any of the Search Options selected in the Replace dialog under 'More'?

What language is set for the text in the document?

Are you using Word 97-2003 or Word 2007 document types as your default?

Have you recycled old temp files on the computer / server that can be left behind when Word is shut down in an abnormal manner and
tried the test again?

From Start=>Find
search on
~$*.*;*.tmp

=========
I have been dealing with an interesting problem one of my users brought to me
which I believe has exposed a bug that has appeared in Word 2007 with SP1.


SUMMARY:
Documents containing conditional hyphens can cause Word to hang and consume
100% CPU when using the Find or Find & Replace command.


VERSIONS FOUND AFFECTED:
Word 2007 SP1
Specific build tested Microsoft Office Word 2007 (12.0.6212.1000) SP1 MSO
(12.0.6213.1000) running on Vista Enterprise, Vista Enterprise SP1 RC v.688,
and XP Professional SP2

VERSIONS NOT AFFECTED:
Word 2003 (SP1 and SP2)
Word 2007 (No SP)

VERSIONS UNTESTED:
All other versions.


REPRODUCIBLE: 100% with identified versions.


STEPS TO REPRODUCE:

1. Open the identified affected version of Word.

2. (Optional for readability, does not affect test case) On the Home tab, in
the Paragraph group, click Show/Hide to show formatting marks.

3. Type the word "Test"

4. Press the Enter key

5. Press the Tab key

6. Press the Enter key

7. Press Ctrl+- (Control + Hyphen) twice.

8. Press the Enter key

9. On the Home tab, in the Editing group, click Replace.

10. For 'Find what', enter "Test", and for 'Replace with', enter "Testing"

11. Click Replace All.

12. Observe that Word stops responding. Task Manager can be used to verify
that Word is consuming as much CPU as possible (up to 100%)



BACKGROUND:

The user had a number of documents that she frequently re-used by opening an
existing document, executing a Find & Replace > Replace All on a name in the
document, and saving the modified file as a new document. We recently
released Office 2007 SP1 through our WSUS server, and since then, the user
had found that her normal Find & Replace method was causing Word to hang and
consume 100% CPU, until Word was forcibly terminated using Task Manager.

After some investigation, I found that this behaviour can be reproduced when
you have more than 1 consecutive conditional hyphen in the document at any
point AFTER some other non-printing character (tested with tab and page
break), and the Find function is used to the point where it passes the
conditional hyphens. So, if Find All or Replace All is used, it will fail
immediately, or if the single Find or Replace commands are used, it will fail
as soon as it tries to search beyond the conditional hyphens.

In this case, the conditional hyphens had been entered accidentally,
possibly years ago given the amount of time the user has been producing these
documents. Removing them corrected her problem.

So far I have found this behaviour is only exhibited in Word 2007 SP1. I
can't say for certain that I've narrowed it down completely; other
non-printing characters may trigger this other than tab and page break,
possibly other characters than conditional hyphens will trigger it too, but
the above test case works for me every time.

I'd appreciate any input anyone can give!>>
 
J

Jay Schlackman

Bob, thanks for your reply, and sorry for my delay in getting back to you -
hectic day here. Your findings are quite peculiar. I just tried my own test
case on 2 previously untested home machines (one Office Enterprise on Vista
Business, and one Office Professional Plus on Vista Business) and the
original problem machine at work (Office Enterprise on XP SP2) and all
crashed as before. I've tried this on about a dozen or so machines now, each
time crashing as expected.

In response to your suggestions:

- It does happen in Safe Mode

- There are no search options set

- It happens when using either type of document format as the default

- The language is normally set to English UK, I tried setting to English US
and the problem still occurred.

- I deleted all temp files from %temp% and confirmed no temp files matching
your pattern were present on the system.


I can't think what else could be different. One thing I did notice while
devising the test case is that if I enter just a single conditional hyphen,
run the find & replace, then entered the second hyphen and run the test
again, it does NOT hang. Only if entering the two hyphens at the same time in
the same session does the problem occur. I don't suppose by some bizarre
coincidence you've hit that my mistake?

After your suggestion about running in Safe Mode I also tried uninstalling
the only plugin that is installed on these machines (Save As PDF and XPS),
but that had no effect either.

Regards,
Jay
 
G

gilbar

Jay, we're having simular problems with find & Replace. Our problems are
happening when we try to find a string (like ~HE) that is on the end of a
paragraph; so we look for ~HE^p
When we do this, it cases hang Word, just like your problem. This happens
mostly when we do it in a macro (Selection.Find.Execute FindText:="~HE^p"),
but sometimes it hangs even when doing this manually.
Hoping that the Powers that be fix this !
 
S

stiller41

I too had that problem and found a workaround.

1. In Windows explorer, call up the document/
2. Save the document as a Word 97-2003 file and close it.
3. Close the Windows Explorer dialogue box/
4. Re-open Windows Explorer and re-open the document.

Find & Replace should now work without hanging.

That worked for me.

andy g.
 
J

jh

Hi!

I justed wanted say that for me, this "Windows Explorer" trick didn't make
sense (that's just the .doc trick) and also it did not fix the problem for
me. However, I could save as Other Formats -> Word XML Document (.xml), and
using that, the Find crash didn't occur anymore!

I could also save back to .docx and still have no problems. Also I could
retain all links, images, formatting and so on.

Good luck!
 
Ad

Advertisements

J

jh

Now, after a couple of days, I have to say that unfortunately my workaround
doesn't work for me any more. I can't use Find in my document, it will result
in a crash. It doesn't help for me any more if I save at other formats. It
will crash anway.

By the way, this problem is only with the SP1 version. It's fine in the
original version. And there is also another bug (on both versions): text
jumps around occasionally during the automatic rewrap while writing so, that
the screen is not updated properly. This results in a total mess; cursor is
not really where it seems to be (or the text is not as it seems).
 
J

jh

Ok, I think I finally found a working workaround.

Word Options -> Display -> Always show.. -> [v] Optional hyphens (or you can
put Show all formatting marks if you want)

Then, find in the document the place where you have multiple (at least two)
hyphen marks consecutively (¬¬) and delete those. Without those, the Find
function will work properly.
 
V

vandusenc

I have been having this problem as well, and thanks to these posts, now I
know what the problem is.

In addition to jh's reply below, I found that if the formatting (font,
style, size, colours and whatnot...) are not an issue, simply saving the file
as text only, closing, and openning the document again gets rid of any
offending characters.
 
B

Bob Buckland ?:-\)

Hi Vandusenc,

When saving as plain text and reopening do you still have two hyphens?

If you save as the document to XML and reopen rather than as text do you still get the error?

=========
I have been having this problem as well, and thanks to these posts, now I
know what the problem is.

In addition to jh's reply below, I found that if the formatting (font,
style, size, colours and whatnot...) are not an issue, simply saving the file
as text only, closing, and openning the document again gets rid of any
offending characters. >>
--

Bob Buckland ?:)
MS Office System Products MVP

*Courtesy is not expensive and can pay big dividends*
 
S

sjc

Thank you JH!! This issue has been plaguing me and your solution worked. To
quickly find those problematic hyphens, select the "more>>" button in the
find/replace window, then click the "special" and select "Optional Hyphen",
then click
the "find next" button.
 
Ad

Advertisements

K

ketabkhaneh

Dear Sjc

I did your comment but clicking the FIND NEXT caused the WORD to be hanged


sjc said:
Thank you JH!! This issue has been plaguing me and your solution worked. To
quickly find those problematic hyphens, select the "more>>" button in the
find/replace window, then click the "special" and select "Optional Hyphen",
then click
the "find next" button.


jh said:
Ok, I think I finally found a working workaround.

Word Options -> Display -> Always show.. -> [v] Optional hyphens (or you can
put Show all formatting marks if you want)

Then, find in the document the place where you have multiple (at least two)
hyphen marks consecutively (¬¬) and delete those. Without those, the Find
function will work properly.
 
D

danezeq

i searched for hyphen marks (¬¬) in my documents and it didn't find any.
STILL my word stuck in Find&Replace (and in Find to)

these 2 documents contain english and hebrew.

what shall i do?
 
B

Bob Buckland ?:-\)

Hi Danezeq,

Are you using Word 2007 SP1 as mentioned in the subject line?
What was the specific search parameters you were using?
Was the document created in Word 2007 originally?

==============
i searched for hyphen marks (¬¬) in my documents and it didn't find any.
STILL my word stuck in Find&Replace (and in Find to)

these 2 documents contain english and hebrew.

what shall i do?>>
--

Bob Buckland ?:)
MS Office System Products MVP

*Courtesy is not expensive and can pay big dividends*
 
K

ketabkhaneh

Dear Bob

Hi,

Does Microsoft propose a solution or an update for this problem?

Please guide me how can I remove the problem. Since the problem is very
often occur in my files it actually stops my working.

Look forward to hearing from you.
Regards

Ketabkhaneh
 
D

danezeq

- Yes. im using Word 2007 SP1.
- I search for a word in hebrew "הסכמה" but i think it can happen also in
english. (and not merely this particular word)
- Yes i created the document in 2007 (or 2003)
 
Ad

Advertisements

G

Gharib

This problem has been wearing me down for some time too, and I think I might
have a clue to the cause. In my work, I have to edit a lot of Arabic Word
documents; this of course requires a lot of gobal replacements. This problem
has forced me to stop and restart Word many times. In my case, the search
pattern could be any text, and I never had a special hyphen included in the
search.

I believe the common pattern I found includes the following conditions:

1. "track changes" on
2. the string has been replaced successfully at least once before the
attempt to do the global replacement
3. It follows from (2) above, that the search string exists in at least one
of the tracking "baloons".

I only had the problem with Arabic documents, not with English ones. I also
think that the above conditions are always true when the problem occurs, but
this does not mean that whenever these conditions are true, the problem has
to occur. It happens with some strings, not others. But if it happens with a
certain string, it always happens with that string under the same conditions.
If I edit the document without track changes, the problem does not happen.
Unfortunately for me, track changes is a necessity.

My guess is that with track changes on and the string already being tracked
because it was replaced once, Word seems to get into some time of pointer
mess or get into a loop as if the search continues into the "search string
instances" that are saved in the "tracked" data structures.

If this helps, please help by providing a workaround or an urgent fix.

Regards,

Alaa Zeineldine
 
N

Neil Cumfer

Hello,

I am not sure where this reply came from or how it got in this
newsgroup, but I would like to offer some additional information on the
problem.

I performed the 12 STEPS TO REPRODUCE as presented and obtained the
behavior specified;
However, there are other occasions when Word will hang when the Find &
Replace dialog box is used.

This behavior started immediately after applying Service Pack 1 to Word
2007 on a computer running XP Professional with Service Pack 2.

I am trying to find ^p^w and replace it with ^p (effectively deleting
white space after a paragraph mark).

Before applying Service Pack 1 to Word 2007, there was never a problem,
but after applying the service pack, Word hangs if this is attempted in
certain documents, even the same documents that had no problem with it
before the service pack was applied. These are English language
documents; track changes is off.

These documents do not contain conditional hyphens, so conditional
hyphens isn't the whole story. The only thing special in these
documents are some nonbreaking hyphens, page breaks, and an ellipsis.
If these are removed, the Find and Replace dialog box still hangs.
Also, there are some bullet lists, and the documents have been heavily
edited and reused numerous times. There are 2 text boxes in the header,
one contains text and the other contains an image.

I got the same hangup when starting Word in safe mode. None of the
Search Options after 'More' are checked. The default document type is
Word 2007; however, these are ".doc" files. (The same problem occurs if
they are saved as ".docx" files and reopened.) Temp files have been
deleted.

I hope these clues can help Microsoft patch their service pack.

The next day after running into this problem, I discovered that the VBA
statement "ActiveDocument.Save" is no longer reliable either. On one
document (different from the documents cited above), I got a VBA error
message stating that the object's Method or Property (.Save) in not
available because ... something to the effect that the document is not
in Full Screen Reading View.

The next day I discovered that Microsoft crafted Service Pack 1 so that
it could not be unistalled!

Happy weekend everybody

Neil
 
K

Klaus Linke

I have the problem in a lot of files lately, too.
Arabic language support is installed because some of the files need it.

I don't use "Track Changes", so it seems doubtful that it's necessary for
the bug to hit. But I haven't found a way to build a reproducible case yet.
The document format (docx, doc, rtf, xml...) also doesn't seem to be
relevant.

A thing I noticed:
If the cursor is in the same paragraph as the text you're searching for,
"Find" or "Find/Replace" never seems to hang.

I have also run into other issues with Find/Replace lately. Say if I search
for a character style, and the match occurs in a paragraph that's followed
by a table, then the last character often isn't matched.

Don't know if the issues are related, but they appeared at about the same
time, and seem to go away when I remove the Arabic language support.

Regards,
Klaus
 
Ad

Advertisements

K

Klaus Linke

After a bit more testing, I'm not sure any more whether BiDi language
support has much to do with the problem.
Tables don't seem to, either.

I stripped a doc that hang when using "Find" down as much as possible.
I saved in Word2003 XML format.

Then I cut the optional hyphen that caused the problem, and pasted it in
again.
The problem went away ("Find" didn't hang any more).

I saved that "repaired" file, too.

If I cut the soft hyphen (either by itself, or with some more text following
it) and then use "Undo", that fixes the problem for the moment, too.
But if I close and re-open the file, the problem reappears.

Comparing the broken and repaired files, the only difference was in some
rsid elements (revision save ids, such as w:rsidP="########").
They're expected since I "revised" the file, but apart from them, the files
(especially the optional hyphen <w:softHyphen/>) looked the same.

Really weird...

Klaus
 

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