• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 671
  • Last Modified:

To access .XLS by MFC

How can I create and access the .xls(MicrosoftExcel) file
by MFC?
Thank you very much.
0
liufeng
Asked:
liufeng
1 Solution
 
gspkCommented:
Use OleAutomation ...
0
 
Tommy HuiEngineerCommented:
MFC does not have any classes that will do this. I would recommend you take a look at the book Microsoft Excel 97 Developer's Kit which has a thorough discussion on the file format.
0
 
V245Commented:
I'm late a little because I had to check some idea.
If you don't like OleAutomation ( I'm not familiar  with it :-( ) you can choose another way to solve your task. I mean using ODBC. I used it once to solve a similar task. I don't know a 'beautiful' way to create .xls file by means ODBC so I used the following (as far as I recall):
1) I kept a dummy file created by MS Excel and made it's copies whenewer they were necessary.
2) I used CDatabase::ExecuteSQL to make necessary worksheets in the new dummy files.
3) After that I used CRecordset to work with new worksheets.  

MFC doesn't have means to create .xls files but it sure has means to access them. ;-)

I hope it will be usefull.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now