New Bug: Word 2007: Can result in deletion of template files

P

Pope7

Here is the setup. We've been able to reproduce this bug on multiple (more
than 6) Vista PCs with Office 2007. I've not tried to reproduce it on
non-Vista systems.

Name: We're calling it the "Double Save Prompt" bug.
Effect: It destroys template documents in a non-retrievable fashion.

Here is the scenario. I am working in collaboration with another person to
produce a set of templates for a client. After a few rounds of changes, the
client stated that they could not save changes to templates. They sent the
changes to me, and I discovered the same problem. Here are the steps that
reveal the problem:

Please note: I've been able to reproduce this even after I removed all other
templates, quickstyle sheets, and themes.

1.) I received a new theme for the template.
2.) I received a new quickstyle sheet.
3.) I opened up the most recent version of the Word template.
4.) I applied the new theme.
5.) I loaded the quickstyle sheet.
6.) I went through the document and applied the new quickstyle sheets to the
lorem ipsum text of the template.
7.) I removed from the quickstyle sheets any of our custom styles that we
had deprecated
8.) I went to Word button -> Save as -> Save as Template
9.) The Save As dialog box appeared and prompted for a file name, I chose
Version 1A.dotx
10.) Another Save As dialog box appeared and prompted for a file name, but
this time the document type was for a Word 97 document, I chose Version 1A.doc
11.) With the saves complete, I exited Word.
12.) Once Word closes, the Version 1A.dotx is erased by Word from the system.

After this happened, I wondered what was going on. I made a backup of the
template and started the procedure over. This time, I saved as .dotx as the
first prompt and canceled the second prompt.
Result: the Version 1A.dotx was erased by Word when the program closed.

Again I tried, this time I saved the .dotx and the .doc. Before exiting, I
saved again and received a double prompt again. I saved the first set of
files as Version 1A.dotx, Version 1.doc, and the second set as Version
1B.dotx and Version 1B.doc. Before closing the document, I opened an Explorer
window and created copies of the 4 documents and placed them in a different
folder. Then I exited Word.

Result: on the desktop, all files were erased except the Version 1A.doc.
Word deleted Version 1A.dotx, Version 1B.dotx, Version 1B.doc. Note: If you
save your template over itself at any point in these processes, Word will
delete your original file.

I opened up the backup folder I'd made of the documents and opened each file.
Version 1A.dotx, Version 1B.dotx, Version 1B.doc were all empty files. Yes,
I had made an actual copy - and not just a shortcut - of each file. Only
Version 1A.doc had any document data in it.

Under the hood, it appears that in the "double save" bug Word encounters a
problem when writing to the file system. A new file structure is created and
upon exiting Word detects something is wrong with the file and deletes it
from the system without prompting the user. The deleted documents are not
retrievable from the recycle bin.

The work around is this:
1.) Word button -> Save As -> Save as template
2.) When prompted, save your file both times. This will give you a .dotx and
a .doc of the file
3.) Exit Word
4.) The .dotx will disappear
5.) Open the .doc file
6.) Word -> Save As -> Save as template
7.) When prompted, save your file. This time you will not receive a double
prompt.
9.) Exit word
10.) The new template file you created will still exist, and you will no
longer be double prompted during saves after any future changes.

The problem with this bug is very apparent: if the user saves over the
current template file, as soon as Word has been exited, the template will be
deleted from the system. The changes are not saved and the users files are
deleted.

I have a full set of the documents we used to recreate the error. Here is
the interesting thing: of the four template files created (all are variations
of a parent template), 3 are affected by this bug, and 1 is not.

I have a full set of all themes, quickstyles, and templates used to create
this bug. It should be possible to shared the documents with an MVP in order
to recreate the bug, but this might require an NDA due to the nature of the
client the templates are being constructed for.
 
T

Tony Jollans

I have a full set of the documents we used to recreate the error. Here is
the interesting thing: of the four template files created (all are
variations
of a parent template), 3 are affected by this bug, and 1 is not.

This suggests the problem is related to the individual templates rather than
Word itself. Whilst it is possible there are any number of file-system
related issues, the most likely explanation is code in your templates. Do
they trap Save and/or Close commands in any way?
 
P

Pope7

I'll see if the save or close bring up the double save situation.

I completely agree in that it is most likely a template bug issue. But the
idea that a user could create a template that destroys files qualifies as a
bug out of the normal. If it were caused by custom code or something that
would be one thing (such as a macro in a document), but this is 100% created
and caused by Word.

I'll post my findings this afternoon.
 
P

Pope7

Tony,

Save and Close both invoke the "double save".

The first save is selected as .dotx and the second as .doc. So I tried this...
1.) Changing both saves to .dotx
2.) Changing both saves to .doc
Result: Now an error appears saying "File Error:
/path/to/file/here.whateverextention" In fact, changing the file types to
match is the only way to get the error message (this is for all error types)

I think on the first save prompt it hits the error, so it is asking for the
document to be saved again. Depending on how you save the second time, it
still hits the error but under certain conditions it fails to catch the
error, which results in the lost file

Note: I've now also witnessed this erase documents that were not open and
were not versions of the current open document. This is concerning.

Also, if you save the document as .doc, open the .doc, save it as .dotx
Themes becomes disabled and if you apply any style (it doesn't matter what
the style is) it comes out as system font but dark blue.

I tried removing all graphics from the template. The result is still the same.
I removed all styles. The result is still the same.
I removed all themes. The result is still the same.

The world is ready for a new word processor.
 
T

Tony Jollans

What you describe simply is not done by Word. What makes you say it is Word?
Does it still happen if you run Word in safe mode and don't allow macros in
your template to run?
 
P

Pope7

1.) The templates do not contain any macros at all. They never have. They
never will.
2.) I can reproduce the issue across different machines in a heterogeneous
work environment and on client machines.
3.) Because I know what I'm doing
4.) I have a long history of beta testing and discovering undocumented bugs
for which a patch is later issued. :) It is my contribution to making the
binary world a better place.

Here is a bit more information...
During the "double save" bug, the file saved are not empty, but they don't
contain any test/styles/content/picture. I tested this by...
1.) Saving from the first prompt.
2.) Copying the file to a new location
3.) Opening the file - it was empty, but when opened with a hex editor did
contain content of sorts.

I preserved such a file and then reproduced the "double save" bug and used
the first prompt to save over the file I had made in the Step 2 above. It
asked if I wished to overwrite or merge. I chose merge. In this scenario,
from the merge display area (where it shows the final merge result and views
of the two merging documents) all three window areas shows information. Ex:

If the panes are: A, B, and C (with A being the merged final result, B merge
file 1, C merge file 2), A showed B+C, B showed the content of the current
file, C showed the content of the file created in Step 3 above. However, if
file C was opened on its own (ie - not opened through a merge dialog) the
file file contained no content/pictures/text/etc...
 
P

Pope7

Here is a better, clearer explanation of the previous post, which after a
re-read I felt didn't explain things as clearly as possible.

Why do I know this is caused by word?
<insert numbers 1-4 of the previous post here>

I did some further testing and I've found some more interesting things....

A.) Empty Files
During the "double save" the documents generated have a file size, but have
no file content. If you recreate the bug and save a file at the first prompt,
you can drop to the desktop and open the file. The file has a size, in a hex
editor contains contents, but in Word the file appears to be blank (no text,
styles, pictures, etc...). The same is true of the file created at the second
prompt (as long as you don't chose the same file type used in the first
prompt, which of course I've documented as showing a file error.

B.) Merging Files
Let's say the template is called theTemplate.dotx
1.) Recreate the bug
2.) At the first prompt save the document as newFile1.dotx
3.) At the second prompt save the document as newFile1.doc
4.) Copy the new (but empty files) to a new folder (I copied them to a USB
drive then removed the drive)
5.) Exit Word
6.) Word (or the file system) erases newFile1.dotx and newFile1.doc
7.) Copy the files from the USB drive back to the computer
8.) Open theTemplate.dotx file and recreate the bug
9.) This time, at the first prompt choose to save the file as newFile1.dotx
again.
10.) Word will prompt you to replace or merge the files because they have
the same name.
11.) Choose Merge
12.) The Merge Dialog view will appear. For this example, we'll call the
panes from left to right: Merge View, Source 2 (the new file), and Source 1
(the file from step #7)
13.) Merge View will show content from Source 2 + content of Source 1. Here
is the interesting part: if you open up the file from Step #7 - it still
appears in Word as a blank document. But in Merge View suddenly the content
is appearing.
14.) The Source 2 and Source 1 panes both show content. Even though - when
opened separately and simulatenously, the Source 1 file (from step #7)
appears as blank inside Word.
15.) I will update later, but I believe the result of saving the merge is a
file that disappears (I'll have to double check, because I forgot to write
the result down in my notes)
 
B

Bob Buckland ?:-\)

I wasn't able to reproduce the behavior on a Windows XP machine. Did not receive a 2nd prompt to save a file. All saves were to
the local drive (i.e. no network or roaming folders).

Some of the repro steps are 'best guess', for example in step 7 chose a style to delete, as no way to know anything about your
specific deprecated files. If you can provide a link to the set of test files (including the thmx and dotx (Quick Style) that might
be helpful, but it could also relate to the local settings/policies set for compatibility options and defaults.

Did you try this in safe mode as Tony mentioned (hold control key when starting Word) then repeating the steps?

Is there more than one version of Office installed?

Is the Office compatibility pack installed? (Shouldn't be needed if only Office 2007 is in play).

Are the Theme and QuickStyle files in their 'usual' locations (i.e. the one you'd get if you were saving a new Theme, font, colors
or Quickstyle set) when you're loading them?

====================
Here is a better, clearer explanation of the previous post, which after a
re-read I felt didn't explain things as clearly as possible.

Why do I know this is caused by word?
<insert numbers 1-4 of the previous post here>

I did some further testing and I've found some more interesting things....

A.) Empty Files
During the "double save" the documents generated have a file size, but have
no file content. If you recreate the bug and save a file at the first prompt,
you can drop to the desktop and open the file. The file has a size, in a hex
editor contains contents, but in Word the file appears to be blank (no text,
styles, pictures, etc...). The same is true of the file created at the second
prompt (as long as you don't chose the same file type used in the first
prompt, which of course I've documented as showing a file error.

B.) Merging Files
Let's say the template is called theTemplate.dotx
1.) Recreate the bug
2.) At the first prompt save the document as newFile1.dotx
3.) At the second prompt save the document as newFile1.doc
4.) Copy the new (but empty files) to a new folder (I copied them to a USB
drive then removed the drive)
5.) Exit Word
6.) Word (or the file system) erases newFile1.dotx and newFile1.doc
7.) Copy the files from the USB drive back to the computer
8.) Open theTemplate.dotx file and recreate the bug
9.) This time, at the first prompt choose to save the file as newFile1.dotx
again.
10.) Word will prompt you to replace or merge the files because they have
the same name.
11.) Choose Merge
12.) The Merge Dialog view will appear. For this example, we'll call the
panes from left to right: Merge View, Source 2 (the new file), and Source 1
(the file from step #7)
13.) Merge View will show content from Source 2 + content of Source 1. Here
is the interesting part: if you open up the file from Step #7 - it still
appears in Word as a blank document. But in Merge View suddenly the content
is appearing.
14.) The Source 2 and Source 1 panes both show content. Even though - when
opened separately and simulatenously, the Source 1 file (from step #7)
appears as blank inside Word.
15.) I will update later, but I believe the result of saving the merge is a
file that disappears (I'll have to double check, because I forgot to write
the result down in my notes) >>
--

Bob Buckland ?:)
MS Office System Products MVP

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

Pope7

Bob,

It isn't reproducible with just any template a person creates. It is a bug,
but a rare bug for sure. Basically, I made this post so if other people run
in to the error, they at least know they're not insane and that Word is
messing up. Seeing as I can rule out that this is not caused by macros, I
find it interesting.

I can get Word to throw an actual error dialog, but it is too generic: "File
problem /path/name.txt" (or something along those lines - I gave the specific
error in a previous post). But Word fails to always present this error.

1.) In safe mode the error still occurs. This will probably lead someone to
say "Then it isn't a word problem," which is not correct.

2.) There is only one version of Office installed.

3.) It doesn't matter which user is logged in.

4.) There is no compatibility pack installed.

5.) The Themes and Quicksyle files are in their typical locations.

I'd love to post the files, and perhaps I can at a later date. But for the
moment they are covered by NDA. The only way I could probably release the
files at the moment is if an MS employee requested them and filled out an NDA
as well.

Here is how I've finally handled the situation...

1.) Open the .dotx
2.) Make any needed changes
3.) You'll get the double prompt.
3a.) First prompt: save as .dotx
3b.) Second prompt: save as .doc - in the background, switch over and make a
copy of this file. It shouldn't disappear but copy the file to be safe.
4.) Close Word. The .dotx will disappear.
5.) Open the .doc file
6.) Save it as a .docx. Deselect compatibility mode. Even if compatibility
mode is not selected, you need to check and uncheck it because under the hood
this has an affect.
8.) Close Word
9.) Open the .docx
10.) Save it as a .dotx
11.) Now the file should work properly.

If you don't close out between each step, the process doesn't always work.

The people working on this file all have Office 2007. And no one should have
been saving the files as anything less than .docx without compatibility
information. However, my guess is that someone saved it with compatibility
mode and that is the core of the problem.

I say this, because Step 9 strips out compatibility information, and then
the files are fine.
In Step 6 it seems Word doesn't always correctly detect whether a file is in
compatibility mode.
 

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