分享

ystem.Runtime.InteropServices.COMException (0x800A1066): 命令失败

 figwinlif 2013-01-29
asp.net 常用的生成word功能,代码也是网上常见的,自己本地反复测试过没问题。
serves 2003下运行没问题,可是发布到2008上就出错。组件权限已配置,windows目录下temp权限已给,程序目录权限已给,也加入了<identity impersonate="true" userName="administrator" password="XXXXX"/>,连administrator的用户控制都关了。

网上常见的模版生成法:
Document MyDoc = wordApp.Documents.Add(ref tempName, ref missing, ref missing, ref missing); 
到这里时出错,显示Word出现问题.


html生成word,在加载html文件时出错(Word.Selection.InsertFile):
System.Runtime.InteropServices.COMException (0x800A1499): 文档名或其路径无效。 (D:\web\temp\63384007.html)
  在 Microsoft.Office.Interop.Word.Selection.InsertFile(String FileName, Object& Range, Object& ConfirmConversions, Object& Link, Object& Attachment)
文件存在,目录权限也有。


保存word文档时也出错(Word.DocumentClass.SaveAs):
System.Runtime.InteropServices.COMException (0x800A1066): 命令失败
  在 Microsoft.Office.Interop.Word.DocumentClass.SaveAs(Object& FileName, Object& FileFormat, Object& LockComments, Object& Password, Object& AddToRecentFiles, Object& WritePassword, Object& ReadOnlyRecommended, Object& EmbedTrueTypeFonts, Object& SaveNativePictureFormat, Object& SaveFormsData, Object& SaveAsAOCELetter, Object& Encoding, Object& InsertLineBreaks, Object& AllowSubstitutions, Object& LineEnding, Object& AddBiDiMarks)

word已经正常安装,组件也应该被程序正常加载,代码没问题,网站是用asp.net2.0开发的,其它功能都没问题,可是就是导出word出错,应该是win2008设置的问题,可实在找不出是什么原因????




这个问题到今天才算是真正解决了,64位服务器布置跟32位的区别是:

  C:\Windows\SysWOW64\config\systemprofile\Desktop
  C:\Windows\System32\config\systemprofile\Desktop

就是看下上面的文件夹有没?没有新建个文件夹就行了,泥马的困扰俺这么久!!!

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多