Click here to Skip to main content
Rate this: bad
good
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.
 
Nick
Posted 7-Oct-10 7:03am
Rate this: bad
good
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[^]
  Permalink  
Rate this: bad
good
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.LoadXls(FilePath);
            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);
        }
    }</insert>
  Permalink  
v3
Comments
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 OriginalGriff 280
1 Jochen Arndt 150
2 Kornfeld Eliyahu Peter 120
3 PIEBALDconsult 110
4 Richard MacCutchan 105
0 OriginalGriff 6,055
1 DamithSL 4,621
2 Maciej Los 4,087
3 Kornfeld Eliyahu Peter 3,500
4 Sergey Alexandrovich Kryukov 3,294


Advertise | Privacy | Mobile
Web03 | 2.8.141220.1 | Last Updated 29 Apr 2012
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