•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 401,657 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,684 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Views: 18102 | Replies: 7
![]() |
•
•
Join Date: Dec 2004
Location: Hong Kong, SAR
Posts: 22
Reputation:
Rep Power: 4
Solved Threads: 1
Dear all,
Is it ever possible to write a programme in C++ which enables me to:
1) Read the data in spreadsheet of MS-Excel
2) generate another Excel file as output ?
Also, are there any standard library could do the job?
One of my friend said using Visual Basic could make the task easier since it deals with Excel. Any comment on this?
Jim :rolleyes:
Is it ever possible to write a programme in C++ which enables me to:
1) Read the data in spreadsheet of MS-Excel
2) generate another Excel file as output ?
Also, are there any standard library could do the job?
One of my friend said using Visual Basic could make the task easier since it deals with Excel. Any comment on this?
Jim :rolleyes:
•
•
Join Date: Nov 2004
Location: Netherlands
Posts: 5,693
Reputation:
Rep Power: 18
Solved Threads: 195
Your friend is dead wrong. Excel DOES include VBA which is a scripting language based loosely on VB but that's about it.
All of the MS Office applications expose a series of COM controls which you can use to manipulate their documents.
I don't have the documentation for them at hand but you should be able to find examples in the MSDN library at http://msdn.microsoft.com and elsewhere.
There are likely also other systems to access and manipulate the documents available through third parties.
All of the MS Office applications expose a series of COM controls which you can use to manipulate their documents.
I don't have the documentation for them at hand but you should be able to find examples in the MSDN library at http://msdn.microsoft.com and elsewhere.
There are likely also other systems to access and manipulate the documents available through third parties.
•
•
Join Date: Oct 2004
Location: Mojave Desert
Posts: 2,425
Reputation:
Rep Power: 9
Solved Threads: 173
•
•
Join Date: Jun 2004
Location: Marin, CA, USA
Posts: 434
Reputation:
Rep Power: 5
Solved Threads: 10
Another possability is to export the Excell code to XML, modify it, and pull it back into Excell. This works very well with Excell XP and later, not so well with versions earlier than Excell XP.
The "right" way to do it is with the COM calls, and the managed code (C#, VB) is generally easier to deal with COM than in C/C++. But using the XML method does not involve all that, nor does it require Excell to be present on the machine that does the conversion.
The "right" way to do it is with the COM calls, and the managed code (C#, VB) is generally easier to deal with COM than in C/C++. But using the XML method does not involve all that, nor does it require Excell to be present on the machine that does the conversion.
•
•
Join Date: Dec 2004
Location: Hong Kong, SAR
Posts: 22
Reputation:
Rep Power: 4
Solved Threads: 1
Thank you for all of your input.
Just to make the problem clearer:
In fact I have only learned C++ for one semester only but recently my professor asked me to write a programme like this. Since there's a time constraint and I only know C++, I have to choose from the 1 of the 2:
1) Use VC++, the language which I am more familiar with, but might be more difficult to implement GUI
2) Easier to make GUI but I know NOTHING about BASIC, not to mention VB.
I could also find some document from MSDN by searching for "automate Excel from Visual Basic" as mentioned by jwenting. But the code I found looks so hard and cryptic to me.
Anyway I have started learning VB today. Thank for all of your advice.
Just to make the problem clearer:
In fact I have only learned C++ for one semester only but recently my professor asked me to write a programme like this. Since there's a time constraint and I only know C++, I have to choose from the 1 of the 2:
1) Use VC++, the language which I am more familiar with, but might be more difficult to implement GUI
2) Easier to make GUI but I know NOTHING about BASIC, not to mention VB.
I could also find some document from MSDN by searching for "automate Excel from Visual Basic" as mentioned by jwenting. But the code I found looks so hard and cryptic to me.
Anyway I have started learning VB today. Thank for all of your advice.
•
•
Join Date: Apr 2005
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
I have programmed a lot in VB and a little in C++. It will be easier in VB. The major obstacle you have in C++ is that there is an absense of documentation on the format - ie it is secret. There is a little bit of doco on the security features but that is all.
I have left an easier option underneath.
Try and think of VB as the C++ you learn in Kindergarten - Yes it is illogical, but it is still object oriented, it is just that you have to wade thru lots of new objects.
You have a few options
1) Use C++ to manipulate CSV files. You can save excel files as CSV files (comma separated). This would make it very easy with C++. Your instructor may consider this cheating as you are not technically manipulating an excel file, but ask. Maybe they want you to manipulate data as an exercise and don't care about the format. If so, this is the best way.
2) Use C++ to manipulate XLS files. As stated above, you must crack their format. No data exists on the web (except for very old formats of xl). Good Luck
3) Grit your teeth and learn VB.
I have left an easier option underneath.
Try and think of VB as the C++ you learn in Kindergarten - Yes it is illogical, but it is still object oriented, it is just that you have to wade thru lots of new objects.
You have a few options
1) Use C++ to manipulate CSV files. You can save excel files as CSV files (comma separated). This would make it very easy with C++. Your instructor may consider this cheating as you are not technically manipulating an excel file, but ask. Maybe they want you to manipulate data as an exercise and don't care about the format. If so, this is the best way.
2) Use C++ to manipulate XLS files. As stated above, you must crack their format. No data exists on the web (except for very old formats of xl). Good Luck
3) Grit your teeth and learn VB.
![]() |
•
•
•
•
•
•
•
•
DaniWeb C++ Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- Unable to create an excel file in VB.net (VB.NET)
- Open Excel file from Visual Basic (Visual Basic 4 / 5 / 6)
- grabbing source from excel file (was: please, somebody help me!!!) (Visual Basic 4 / 5 / 6)
Other Threads in the C++ Forum
- Previous Thread: Algorithms
- Next Thread: 'Grocery Counter' using Classes



Linear Mode