WinWord Automation COM无法正常工作 [英] WinWord Automation COM Not working

查看:83
本文介绍了WinWord Automation COM无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在尝试使用C#生成Word文档.
我的要求是使用数据库中的数据自动修改单词doc.
例如:
对于具有2个子项目的项目.我们需要17张桌子
这可以正常工作.但是如果项目的子项目超过10个,则无法打开Word文档,尽管它是在Respective文件夹中创建的


Hi ,

I am trying to generate a word document using c#.
My requirement is to automatically modify the word doc with the data s from the database.
For Eg:
For a Project that has 2 subprojects. we need 17 tables
This works fine .But in case of projects having more than 10 Subprojects.We are not able to open the Word doc.Although it s been created in the Respective folder


string fileName = Server.MapPath(doc.PreparedClosureFileName);
        FileInfo file = new FileInfo(fileName);
        if (file.Exists)
        {

            string script = "frames['frmDownload'].window.location='Download.aspx?FileName=" + Server.UrlEncode(fileName) + "';";
            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Download", script, true);
         }    </pre>





Regards,
Soumya

推荐答案

令人惊讶的是,我们没有收到任何错误消息. Word文档不会自动打开.正如我之前告诉你的.对于子项目少于10个的项目,此方法很好用

问候
Soumya
Surprisingly , we are not getting any Error message. Word doc is not getting opened automatically. As i ve told u earlier. This works fine for projects having less than 10 subprojects

Regards
Soumya


这篇关于WinWord Automation COM无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆