问题
I've searched a lot of info, about the easiest way to create and edit excel files to save some login and passwords of my program. I've seen lots of C# methods and I don't understand it a lot.
I've added a reference to Visual Studio 2010 Microsoft.Office.Interop.Excel
(I'm using Office 2010).
I don't know how to take this further, however; what headers should I add, what else should I do? I can't find any tutorial of C++ using this on their projects. I just want something simple.
EDIT:
I will run my program on a pc that has Office 2010 installed.
回答1:
read these
http://support.microsoft.com/kb/216686/en-us?fr=1
http://www.codeguru.com/cpp/data/mfc_database/microsoftexcel/article.php/c11745/Microsoft-Excel-Automation-Class.htm
回答2:
Does the system where your application will run on have Excel installed or not?
If it does, you can use indeed use Excel as a COM component. http://www.wilmott.com/messageview.cfm?catid=10&threadid=26137 contains an example on how to do this.
If your system does not have Excel installed, you need to use a 3rd party library to create the Excel files for you. Just Google for "create excel files without excel" and you will find dozens of example code.
来源:https://stackoverflow.com/questions/10909422/how-can-i-create-an-excel-file-using-interop-on-c