Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# Excel PDF Outlook
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 | :confused:
 
Thanks for your time, Kind Regards,
 
Nick Austin
Posted 5-Oct-10 1:44am
Edited 6-Oct-10 6:22am
v2
Rate this: bad
good
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.
  Permalink  
Comments
DecodedSolutions.co.uk at 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
good
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.
  Permalink  

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

  Print Answers RSS
0 Richard MacCutchan 269
1 Aajmot Sk 252
2 Marcin Kozub 235
3 Sergey Alexandrovich Kryukov 185
4 Praneet Nadkar 167
0 OriginalGriff 7,913
1 Sergey Alexandrovich Kryukov 7,232
2 DamithSL 5,604
3 Manas Bhardwaj 4,986
4 Maciej Los 4,865


Advertise | Privacy | Mobile
Web03 | 2.8.1411023.1 | Last Updated 13 Dec 2010
Copyright © CodeProject, 1999-2014
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