liufeng
asked on
To access .XLS by MFC
How can I create and access the .xls(MicrosoftExcel) file
by MFC?
Thank you very much.
by MFC?
Thank you very much.
Use OleAutomation ...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.
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.