如何在.net 2.0中的Windows应用程序中生成word文档 [英] how can i generate word documents in windows application in .net 2.0

查看:108
本文介绍了如何在.net 2.0中的Windows应用程序中生成word文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,每个人都好。我想从我的Windows应用程序生成word文档。在Windows应用程序中,我创建了一个名为generate的按钮,如果我单击它需要生成一个单词文档。



我的代码是:



  string  StrContent =  < span class =code-string>< table border ='0'style ='margin-removed10px; margin-removed20px;' cellpadding ='5'cellspacing ='1'>; 
StrContent + = < tr>< td valign ='top'bgcolor ='#FFFFFF' style ='font-weight:normal; font-family: + 这是我的第一个应用程序 + < / td>< / tr>;
StrContent + = < / table>;
WebBrowser webbrowser1 = new WebBrowser();
webbrowser1.DocumentText = StrContent;
webbrowser1.Document.Title = 问题Papper;
webbrowser1.Width = 1000 ;
webbrowser1.ShowPrintDialog();





但我收到错误,因为ERROR HRESULT E_FAIL已从cal返回到a com组件



可以帮助我。



提前感谢!

解决方案

见这里

http://www.csharp-station.com/Articles/WordReports.aspx [ ^ ]

http://nishantrana.wordpress.com/2007/11/03/creating-word-document-using-c/ [ ^ ]



谢谢

--RA


hello to every body. i want to generate word documents from my windows application. in windows application i created one button named generate, if i click it the one word document ll need to generate.

my code is:

string StrContent = "<table border='0' style='margin-removed10px; margin-removed20px;' cellpadding='5' cellspacing='1'>";
StrContent += "<tr><td valign='top' bgcolor='#FFFFFF' style='font-weight: normal; font-family:" + "This is my first application" + "</td></tr>";
StrContent += "</table>";
            WebBrowser webbrowser1 = new WebBrowser();
            webbrowser1.DocumentText = StrContent;
            webbrowser1.Document.Title = "Question Papper";
            webbrowser1.Width = 1000;
            webbrowser1.ShowPrintDialog();



but i got an error as ERROR HRESULT E_FAIL has been returned form a cal to a com component

can any plz help me.

thanks in advance!

解决方案

See here
http://www.csharp-station.com/Articles/WordReports.aspx[^]
http://nishantrana.wordpress.com/2007/11/03/creating-word-document-using-c/[^]

Thanks
--RA


这篇关于如何在.net 2.0中的Windows应用程序中生成word文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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