how can i create an excel file using Interop on c++

*爱你&永不变心* 提交于 2020-01-24 21:31:48

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!