2

The issue consists of two parts:

  1. What are the best .NET libraries to modify (read/write) existing excel document (should be work with Excel 2003)?

  2. What are the best .NET libraries to modify (read/write) existing pdf document?

They should be able to create new document too. It's better if they are free (open source) or not too expensive.

Thanks in advance :)

AstroCB
  • 12,337
  • 20
  • 57
  • 73
SchmerZ
  • 79
  • 1
  • 8

6 Answers6

1

For PDFs: iTextSharp. It's free and it's not hard to learn.

egrunin
  • 24,650
  • 8
  • 50
  • 93
0

Look no further for the Excel part:

Create Excel (.XLS and .XLSX) file from C#

Creating Excel spreadsheets .XLS and .XLSX in C#

Community
  • 1
  • 1
Leniel Maccaferri
  • 100,159
  • 46
  • 371
  • 480
0

Regarding Excel you might not need a library. If you've got Excel installed you can automate it to edit the document, or otherwise you might be able to do what you need just by accessing it via OLEDB to read/write data.

Hans Olsson
  • 54,199
  • 15
  • 94
  • 116
  • Automation is not normally a nice route to go down with Excel. It's difficult to use the API properly without hanging onto COM objects and hence close Excel down, and it isn't always possible if the environment can't support a UI (server hosted for example). – Ian Jun 04 '10 at 08:57
  • I dont want to use Automation or Interop, cause on server office could be not installed. I'm not OLEDB guru, but I do not think that it will give me an efficient way to manage files. – SchmerZ Jun 04 '10 at 09:00
  • @Ian: If you do it the proper way it should always close down properly, but I agree it can be a little messy to get right. You can use it without the UI, but the main problems is that it's slow and unstable, which of course gets much worse on a server. – Hans Olsson Jun 04 '10 at 09:25
  • @SchmerZ: Agree about automation on a server, but depending on what you mean with efficient OLEDB might be ok. If your Excel sheets contain tabular data, then I think OLEDB might work very well for reading and writing data, though if you need to do anything more advanced than that it might be unsuitable. – Hans Olsson Jun 04 '10 at 09:27
  • @ho1 : You can't use it in a non interactive environment (although in an interactive environment yes you can use it without a UI). Windows Vista and above prevent you from being able to user the Interop in non interactive environments. – Ian Jun 04 '10 at 13:54
  • @Ian: Ah, yes, I was thinking Windows 2003, mixing it up with the Excel 2003 in the question. – Hans Olsson Jun 04 '10 at 14:18
  • @ho1: Actually I need full functionallity to modify the document: set and get the value of cell's, add images and charts, etc. – SchmerZ Jun 04 '10 at 19:27
  • @SchmerZ: The only thing I've seen that might support all that is SmartXls at http://www.smartxls.com, but it's not free (though not horribly expensive either). I haven't tried it though, just looked at the website. – Hans Olsson Jun 04 '10 at 19:35
0

I evaluted a number of Libraries in this Post for reading Excel files. My preference was a library called FlexCel as it was very easy to use, quite cheap compared to the alternatives. We've been using it without any problems, has good support and frequent updates.

I believe it has some sort of PDF generation from Excel spreadsheets, I'm not sure if thats what you're after.

Other alternatives are Aspose, they offer an Excel and an Adobe PDF library. They are quite a bit more expensive though.

Community
  • 1
  • 1
Ian
  • 33,605
  • 26
  • 118
  • 198
0

Try Pdf Sharp ==> http://www.pdfsharp.net/

Its all open source and free under the MIT license(So free for commercial use too)

The API is similar to GDI+, Also, they have something called MigraDoc which can be used to create a document in memory and then render it to RTF, XPS, or PDF.

gideon
  • 19,329
  • 11
  • 72
  • 113
0

I decided to use FlexCel for .net - not free but not expensive too. API is not very comfortable so my advice to use the documentation of this library and support pretty good. All features this library can do except charts (but flexcel team promise to add this in the nearest release).

SchmerZ
  • 79
  • 1
  • 8