Click here to Skip to main content
15,884,986 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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
Posted
Updated 6-Oct-10 5:22am
v2

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.
 
Share this answer
 
Comments
DecodedSolutions.co.uk 6-Oct-10 11:40am    
Cheers for the response Richard, ill check out the link you posted and get back to you with the success. in responce to sending emails from c#, i have no problems doing that and have many in place. the main question i am really asking is can you mirror the actions (in my c# code) to do the same as if the user was in excel and clicked [file > send > email as PDF attachment] - one again thanks
Can you use a postscript instead? Then you will not need to buy software to create the file. You can use GSView and Ghostscript.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900