Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

MFC lesson 5 use COM to read EXCEL files

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Extracted from: http://blog.csdn.net/rekrad/article/details/7666196

Development environment: VS2005, using MFC

At present, those who add COM components on the Internet, so that they can call the COM interface to read EXCEL files, are not successful. After adding OFFICE components, no excel.h and excel.cpp files are generated, and the code is not compiled successfully. Originally, there is a difference between VS2010 and VS2005. At present, there is no way to compile with VS2005, but there is no problem with VS2010.

First open Class Wizard, click "From a type Library" under the "Add class" button to import "excel.exe" under the office installation directory (for Excel2003), and then select some classes you need, such as _ Application, _ Workbook,Workbooks, Worksheets,_Wroksheet,Range,Shapes, etc. After clicking OK, the system will generate excel.h and excel.cpp files in your program directory, and add # include "Excel.h" when you want to use these imported classes.

Provide the following solutions:

Copy the Excel.h file and Excel.cpp file in the project under VS2010, as well as the header file added above into VS2005, and reload and compile

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report