Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Programmatically creating Excel file in C++

Tags:

c++

excel

sdk

I have seen programs exporting to Excel in two different ways.

  1. Opening Excel and entering data cell by cell (while it is running it looks like a macro at work)
  2. Creating an Excel file on disk and writing the data to the file (like the Export feature in MS Access)

Number 1 is terribly slow and to me it is just plain aweful.

Number 2 is what I need to do. I'm guessing I need some sort of SDK so that I can create Excel files in C++.

  1. Do I need different SDKs for .xls and .xlsx?
  2. Where do I obtain these? (I've tried Googling it but the SDKs I've found looks like they do other things than providing an interface to create Excel files).
  3. When it comes to the runtime, is MS Office a requirement on the PC that needs to create Excel files or do you get a redistributable DLL that you can deploy with your executable?
like image 942
links77 Avatar asked Nov 25 '11 08:11

links77


1 Answers

You can easily do that by means of the XML Excel format. Check the wikipedia about that:

http://en.wikipedia.org/wiki/Microsoft_Excel#XML_Spreadsheet

This format was introduced in Excel 2002, and it is an easy way to generate a XLS file.

like image 168
Baltasarq Avatar answered Oct 06 '22 21:10

Baltasarq