gopalakrishnan
gopalakrishnan

Reputation: 17

excel to pdf using .net

the input for my .net web application is an excel work book. A work book will have more than one work sheet. Each sheet will have the salary information of each employee. When the employees want to access their salary details, the relevant sheet should be taken from the excel and displayed in PDF format. Is it possible to do this task? Please guide me.

Upvotes: 2

Views: 3967

Answers (5)

Anish Karunakaran
Anish Karunakaran

Reputation: 987

you can use This One

//Export to PDF
            var x = new SautinSoft.ExcelToPdf{OutputFormat = SautinSoft.ExcelToPdf.eOutputFormat.Pdf};
            var pdfpath = string.Format("{0}\\{1}.pdf", currentDirectorypath, fileName);
           x.ConvertFile(localXcelPath, pdfpath);

Upvotes: 0

test
test

Reputation: 2629

The following is what I ended up using:

ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
        "C:\folder\file.pdf", Quality:=xlQualityStandard, _
        IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
        False

Translated to VB.NET of course.

Upvotes: -1

Jeroen Ritmeijer
Jeroen Ritmeijer

Reputation: 2792

Try the PDF Converter Services. It can pretty much convert any modern format using a web services interface and works perfect in server based environments. It also does other things including watermarking and securing PDF files if you need it.

I worked on the application so the usual disclaimers apply.

Upvotes: 0

Conrad Frix
Conrad Frix

Reputation: 52645

This doesn't help for the reading of Excel files but if you want you can want to generate a PDF use free libraries from C# you can use iTextSharp or use XSL Formatting objects to do it with a transform.

Upvotes: 0

Doc Brown
Doc Brown

Reputation: 20044

Since you are going to do this on a server, you should definitely avoid the Excel-Automation-Print-To-File-Convert-To-Pdf route. Best option in your case IMHO is using a third party library which supports your needs like this one:

Excel to PDF .NET

(Any free .NET libraries I know for accessing Excel sheets without Excel do not support printing or converting to PDF).

Upvotes: 2

Related Questions