Click here to Skip to main content
13,003,589 members (59,314 online)
Rate this:
Please Sign up or sign in to vote.
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 5-Oct-10 0:44am
Updated 6-Oct-10 5:22am
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

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.
Comments 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
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

Can you use a postscript instead? Then you will not need to buy software to create the file. You can use GSView and Ghostscript.

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

Advertise | Privacy | Mobile
Web02 | 2.8.170626.1 | Last Updated 13 Dec 2010
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100