How to stop server-generated Word .DOCs from saving with “_files” folders?

橙三吉。 提交于 2019-12-24 02:43:08

问题


I have a Word .DOCument that's being generated by a (classic ASP) server. It's an HTML file that's being output as a .DOC using the application/msword content type. The document is generated fine, saves fine, opens up fine in Word, and is fully editable...

The problem occurs on the next document save in Word. A folder is created in the document's directory with the name "<filename>_files" -- just as if you were saving a web page in IE. Inside this folder are three files: colorschememapping.xml, filelist.xml and themedata.thmx. This happens when originally generating the document using IE or Firefox.

-> How can I prevent these _files folders from being created when saving in Microsoft Word?

(flow: users clicks link in browser, Save (.doc) As..., open .doc in MS Word, edit, save -> "_files" folder)


回答1:


If your output isn't too complicated try using RTF. I've had a decent amount of success by outputting RTF files with a .doc extension.




回答2:


It doesn't only happen generating file from Firefox/IE. Microsoft Word 2007 does it when editing any HTML file and saving.

The issue is that if you delete the directory, the HTML file get deleted too.

My workaround:

  1. Edit the file in Word usual
  2. Save the file
  3. Close the file (exit Word, or just close it)
  4. Right click on file in Explorer Select "Open With"->Notepad.
  5. Delete the file in Explorer
  6. Go back to Notepad and Save

You now only have a HTML file an no _files directory.




回答3:


Word 2007 and 2010 default to multi file HTML documents, linking the document to the content files. This is the default behavior for HTML based documents.

The only way around it, that I've found, is to create a real Word Doc without basing it on HTML, or the user has the select "Single File Web Page" when they do a Save As.




回答4:


Delete to recycle bin. This deletes both the word doc and the unwanted folder. Restore the word doc and then empty the bin.



来源:https://stackoverflow.com/questions/3415310/how-to-stop-server-generated-word-docs-from-saving-with-files-folders

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!