本帖最后由 xcg 于 2010-01-26 11:02:59 编辑

解决方案 »

  1.   

    纯支持
    检查安装office时是否有选择.net support
      

  2.   

    呵呵,就是操作word的几种方法,读写模版、直接生成word、html转word等,网上一搜一大堆,这些在32位下都成功,在64位上就不行咯
      

  3.   

    我就是WIN7 X64,没见有问题
    楼主贴一段示范代码出来,我运行下看看
      

  4.   

    using Microsoft.Office.Interop.Word;    protected void Page_Load(object sender, EventArgs e)
        {
            ApplicationClass wordApp = new ApplicationClass();
            object missing = System.Reflection.Missing.Value;
            object tempName = @"D:\test\temp.dot"; // 模板名称,本例中的模板如后面的图 
            object docName = @"D:\test\a.doc"; // 生成的word文件
            Document MyDoc = wordApp.Documents.Add(ref tempName, ref missing, ref missing, ref missing);这里出错!!
            wordApp.Visible = true; MyDoc.Activate();
            wordApp.Selection.Font.Size = 30; // 字体大小 
            wordApp.Selection.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphCenter; // 居中 
            wordApp.Selection.Font.Bold = (int)WdConstants.wdToggle; // 黑体 // 
            wordApp.Selection.TypeText("hello"); // 文字内容
            // 保存word文档 
            MyDoc.SaveAs(ref docName, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing);
            // 关闭,释放 
            MyDoc.Close(ref missing, ref missing, ref missing); wordApp.Quit(ref missing, ref missing, ref missing);
            MyDoc = null;
            wordApp = null; 
      

  5.   

    在出现错误的时候你看看进程列表里面是否已经有word.exe了?应该是有的,如果有检查一下dcomcnfg的权限是否配置的正确?
      

  6.   

    IIS设为32位的,还得把所有动态库强制编译为目标32位
    因为ANY会被64位优先指向64位动态库的公共缓存目录
      

  7.   


    我是在32位机器上编译后发布到64位机器上的,其它功能都正常,就是对word组件的操作不正常
      

  8.   

    楼主按你的方法每生成一次都会产生一个word进程。有那位用owc生成过word的吗?
      

  9.   

    用Aspose.Word
    参考FortuneBase
    参考地址www.cnblogs.com/mail-ricklee
      

  10.   

    以下代码,成功生成(Aspose.Words)Aspose.Words.Document doc = new Document();
    DocumentBuilder bud = new DocumentBuilder(doc);
    bud.Write("写入文本测试");            
    doc.Save(this.Server.MapPath("测试文档.doc"));机器环境:win7 x64
    vs版本:2008
      

  11.   

    这个问题到今天才算是真正解决了  C:\Windows\SysWOW64\config\systemprofile\Desktop
      C:\Windows\System32\config\systemprofile\Desktop就是看下上面的文件夹有没?没有新建个文件夹就行了,泥马的困扰俺这么久!!!!
      

  12.   

    我创建了 desktop文件夹也不行,权限也设置了,服务器是win2003系统的,快疯了,网上的方法都用光了。
    doc = WordApp.Documents.Open(ref fileName, ref missing, ref readOnly, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref isVisible, ref missing, ref missing, ref missing, ref missing);老是在这里就一直在执行,没反应了。也不知道是什么错