Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: C# Excel PDF
Hi Guys,
Ive been searching the web now for the past few hours looking for a way to convert my excel document in .xls format, (i also have in code, the excel app, workbook and worksheet) if these can be used, and i am looking to convert this into a PDF.
After reading a number of different forums alot of people say this is possible using ITextSharp. I have tried to implement this is code with no luck what so ever, and ive tried looking for a tutorial to give me some hint and cant find any of them.
Alot of people sayu its posible but no one hints at how its done, if anyone could help with this matter or could point me in the right direction i would be very greatful
Kind regards.
Posted 7-Oct-10 7:03am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

I guess these articles should help you out. Did you had a look at them?
Tutorials on creating PDF files using C# 2.0[^]
Creating PDF Tables using C# (.NET 2.0) and iTextSharp[^]
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

I converted Excel (.xls) to PDF (.pdf). But i used GemBox.Spreadsheet.dll & wnvhtmlconvert.dll. It may help you.
using GemBox.Spreadsheet;
using Winnovative.WnvHtmlConvert;
public class PDFBuilder
        private ExcelFile ef = null;
        private string _saveHtmlLocation = "C:\\2.html";
        private string _savePDFLocation = "C:\\1.pdf";
        public PDFBuilder(string FilePath)
            ef = new ExcelFile();
            ef.SaveHtml(_saveHtmlLocation, null, true);
            PdfConverter pdfConverter = new PdfConverter();
            pdfConverter.LicenseKey = "<insert your="" own="" license="" key="" here="">";
            pdfConverter.PdfDocumentOptions.EmbedFonts = false;
            pdfConverter.PdfDocumentOptions.ShowFooter = false;
            pdfConverter.PdfDocumentOptions.ShowHeader = false;
            pdfConverter.PdfDocumentOptions.GenerateSelectablePdf = true;
            pdfConverter.SavePdfFromHtmlFileToFile(_saveHtmlLocation, _savePDFLocation);
Kythen at 7-Oct-10 14:31pm
I'm pretty sure the developer(s) of that PDF converter library would appreciate it if you did not share your license key with everyone.
shakil0304003 at 9-Oct-10 3:37am
That was free license key & i did not do it intentionally. Sorry for my mistake.

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

  Print Answers RSS
0 Maciej Los 495
1 Sergey Alexandrovich Kryukov 419
2 OriginalGriff 360
3 CHill60 310
4 CPallini 275
0 Sergey Alexandrovich Kryukov 10,017
1 OriginalGriff 9,495
2 Peter Leow 5,241
3 Kornfeld Eliyahu Peter 3,373
4 Maciej Los 3,076

Advertise | Privacy | Mobile
Web03 | 2.8.150327.1 | Last Updated 29 Apr 2012
Copyright © CodeProject, 1999-2015
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