Manipulate Excel file using C++??

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Dec 2004
Posts: 22
Reputation: jimFan is an unknown quantity at this point 
Solved Threads: 1
jimFan jimFan is offline Offline
Newbie Poster

Manipulate Excel file using C++??

 
0
  #1
Jan 6th, 2005
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:
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 6,143
Reputation: jwenting is just really nice jwenting is just really nice jwenting is just really nice jwenting is just really nice 
Solved Threads: 213
Team Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: Manipulate Excel file using C++??

 
0
  #2
Jan 6th, 2005
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.
Reply With Quote Quick reply to this message  
Join Date: Oct 2004
Posts: 4,047
Reputation: vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice 
Solved Threads: 935
Moderator
vegaseat's Avatar
vegaseat vegaseat is offline Offline
DaniWeb's Hypocrite

Re: Manipulate Excel file using C++??

 
0
  #3
Jan 6th, 2005
There is a small code snippet on DaniWeb on how to manipulate Excel data from within qbasic. Your friend might not be so far off!
May 'the Google' be with you!
Reply With Quote Quick reply to this message  
Join Date: Jun 2004
Posts: 436
Reputation: Chainsaw is an unknown quantity at this point 
Solved Threads: 10
Chainsaw's Avatar
Chainsaw Chainsaw is offline Offline
Unprevaricator

Re: Manipulate Excel file using C++??

 
0
  #4
Jan 6th, 2005
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.
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 22
Reputation: jimFan is an unknown quantity at this point 
Solved Threads: 1
jimFan jimFan is offline Offline
Newbie Poster

Re: Manipulate Excel file using C++??

 
0
  #5
Jan 7th, 2005
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.
Reply With Quote Quick reply to this message  
Join Date: Apr 2005
Posts: 1
Reputation: doddd is an unknown quantity at this point 
Solved Threads: 0
doddd doddd is offline Offline
Newbie Poster

Re: Manipulate Excel file using C++??

 
0
  #6
Apr 23rd, 2005
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.
Reply With Quote Quick reply to this message  
Join Date: Nov 2005
Posts: 1
Reputation: ChetanWarade is an unknown quantity at this point 
Solved Threads: 0
ChetanWarade ChetanWarade is offline Offline
Newbie Poster

Re: Manipulate Excel file using C++??

 
0
  #7
Jan 17th, 2006
I also want to do same thing,Read/write excel using C++.If u got solution can u sedn it to me.

Chetan
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 3
Reputation: miketillman is an unknown quantity at this point 
Solved Threads: 0
miketillman miketillman is offline Offline
Newbie Poster
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC