C#Excel工作表-以PDF附件形式发送电子邮件 [英] C# Excel Worksheet - Send Email as a PDF Attachment

查看:286
本文介绍了C#Excel工作表-以PDF附件形式发送电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我目前正在根据从数据库中提取的数据数组创建Excel工作表.数据首先显示在文本框/组合等中的窗体上,然后当按下按钮时,将生成一个excel表格,以一个布局精美的庄园显示数据.我设法克服了一些问题,例如添加图像和设置比例尺大小等,最后要实现的ID(通过按我的获胜表格上的按钮)是使用excel电子表格,并且(如果您使用的是excel [点击文件>发送>以PDF附件形式发送电子邮件)
首先将我的excel文档转换为PDF,然后附加到可以发送的电子邮件中.

我已经在网上检查了几个小时,但是没有真正的运气.任何帮助将不胜感激. :confused:

谢谢您的宝贵时间,亲切的问候,

Nick Austin

Hi guys

I am currently creating an Excel worksheet from an array of data pulled from a database. The data is first displayed on a form in text boxes / combos etc, then when a button is pressed an excel sheet is produced displaying the data in a nicely laid out manor. I’ve managed to overcome a few problems I had, like adding images and setting the scale size etc, the last thing id like to achieve (through the push of a button on my win form) is to use the excel spread sheet and (if you was using excel [Click File > Send > Email as PDF attachment)
First Convert my excel doc into a PDF, and then attach to an email, which can be sent.

I have checked the web for this, for a few hours now but to no real luck. Any help would be very much appreciated. :confused:

Thanks for your time, Kind Regards,

Nick Austin

推荐答案

为了将电子表格转换为PDF,我认为您可能需要使用PDF打印机驱动程序.在互联网上可以找到很多东西.或者,您可以使用一种PDF库(
In order to convert the spreadsheet to PDF I think you will probably need to use a PDF printer driver; there are lots to be found on the internet. Alternatively you could use one of the PDF libraries (iTextSharp[^] for example) and write the conversion code yourself. Sending emails from C# is quite a simple matter, and again there are plenty of examples on the internet, and probably here on CodeProject.


您可以改用附言吗?然后,您将不需要购买软件来创建文件.您可以使用GSView和Ghostscript.
Can you use a postscript instead? Then you will not need to buy software to create the file. You can use GSView and Ghostscript.


这篇关于C#Excel工作表-以PDF附件形式发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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