简体   繁体   English

在outlook中附加一个html页面作为c#应用程序中的word文档

[英]Attach in outlook an html page as a word document in a c# application

I am writing a web form application in c# and I have this problem. 我正在用c#编写一个Web表单应用程序,我遇到了这个问题。 I would like to create a button in one page that once is pressed: 1)It opens outook 2)The attachment of the mail to send is the aspx page as a word document. 我想在一个页面中创建一个按钮:1)它打开outook 2)要发送的邮件的附件是作为word文档的aspx页面。

I have tried for two days but I still can't find a solution! 我已经试了两天但我还是找不到解决办法! I almost reached a solution with a script that first (using the Interop.World library) opens Word and create the doc from the html code, and after that runs a macro that opens outlook with the document in attachment... but it works only when I debug the application and it doesn't once the page is published in my local intranet. 我几乎达到了一个脚本的解决方案,首先(使用Interop.World库)打开Word并从html代码创建文档,然后运行一个宏打开Outlook,附件中的文档...但它只能工作当我调试应用程序时,它不会在我的本地Intranet中发布页面。

You can not do this. 你不能做这个。

You create your web app in ASP.NET / JSP /PHP, your website will be rendered as HTML to the client browser. 您在ASP.NET / JSP / PHP中创建Web应用程序,您的网站将以HTML格式呈现给客户端浏览器。 It can not access applications in the client machine. 它无法访问客户端计算机中的应用程序。 If that was possible, People would have written websites where it will automatically open skype / outlook / drop box apps in the client computer and steal relevant data send to the author. 如果可能,人们会编写网站,在客户端计算机中自动打开skype / outlook / drop box应用程序并窃取相关数据发送给作​​者。

The only possiblity you can do something on the client computer is creating an Activex component and Let the user download it and give permissions to run. 您可以在客户端计算机上执行某项操作的唯一可能性是创建Activex组件并让用户下载并授予运行权限。 This is not compatable with all browsers. 这与所有浏览器都不兼容。 You may also look into the capabilities of Silver light run time to see what it can do on the client side ( very minimal). 您还可以查看Silver light运行时的功能,以了解它在客户端可以执行的操作(非常小)。

Summary : Do not plan any features which does something on the client computer. 简介: 不要计划在客户端计算机上执行某些操作的任何功能。 It is nearly not possible. 这几乎是不可能的。

What you can think about is some other libraries which creates some document (PDF ? ) from your data and send an email using the standard email sending procedure in dot net (SmtpClient class). 您可以考虑的是其他一些图书馆从您的数据创建一些文档(PDF?)并使用dot net(SmtpClient类)中的标准电子邮件发送程序发送电子邮件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM