GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
 
 
Thread Tools Search this Thread Rating: Thread Rating: 9 votes, 3.56 average.
  #1  
Old 10-Jan-2005, 01:59
confused_pig confused_pig is offline
New Member
 
Join Date: Jan 2005
Posts: 7
confused_pig is on a distinguished road

Read/ Write EXCEL files using C/C++ programming


Hey pple,

Need some help in reading/ writing of MS Excel files using C or C++ programming. Thought of using C++ programming but apparently, I was unable to generate sensible results from it. --> Thus, I hope that I can find some answers/ help from here.

1. What is the file format that we have to save our spreadsheet as? Is it .csv file format? ??:

2. How do we read/ write Excel files using C or C++ programming?

Thanks
  #2  
Old 10-Jan-2005, 07:43
davekw7x davekw7x is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Left Coast, USA
Posts: 6,153
davekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to behold
  1. Proprietary. Changes with successive releases of new versions of Microsoft Office. If you save your spreadsheed in csv format, it's a text file that you can read with any program. Writing it back as a csv is no problem, but you can't get it back into excel in the same form as the xls file that you had originally. Over the years lots of people have come up with ways to read and write Excel files. In my opinion: if you find a way that works for now, be prepared to experiment and revise and jump through hoops whenever a new version of Microsoft Office is realease. You could look into ODBC solutions, like this http://www.thecodeproject.com/database/excel_odbc.asp Use a search engine to get more links.
  2. Try searching msdn (http://www.msdn.com). You will find things like this: http://support.microsoft.com/default...b;en-us;178782

Note that if you use Mozilla or Firefox you will find that the web page has been cleverly constructed so that the sample code is more-or-less unusable. You may have to use Internet Explorer to get something that you can cut and paste to your machine.

Another thing to investigate may be OpenOffice.org (versions of this run on Windows as well as Linux). The OpenOffice.org spreadsheet program, Calc, can read and write Excel files. You may be able to find links to open software information about how it is done. I haven't tried this. (I have enough things to keep me busy; I don't need another hobby just now.)



Regards,

Dave
  #3  
Old 10-Jan-2005, 22:11
WaltP's Avatar
WaltP WaltP is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Midwest US
Posts: 3,435
WaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to all
Saving in .CSV format is the easiest.

There is a way to hook the Excel application stub into your program. I've done it in VB. Dave's link shows how to do it in MFC. I wonder if there's a way to do it with straight API's... The mind shrinks in horror -- but it might be doable
__________________

Definition: Politics
Latin, from
poly meaning many and
tics meaning blood sucking parasites
-- Tom Smothers
  #4  
Old 19-Sep-2005, 07:41
smitha_aug smitha_aug is offline
New Member
 
Join Date: Sep 2005
Posts: 1
smitha_aug is on a distinguished road
Hi Dave,

This links tells how to write/read into an excel sheet using VB. Is there any way to write into an excel sheet using C code?
  #5  
Old 25-Nov-2005, 00:27
lian1238 lian1238 is offline
Awaiting Email Confirmation
 
Join Date: Sep 2005
Location: Thailand
Posts: 28
lian1238 is on a distinguished road

Re: Read/ Write EXCEL files using C/C++ programming


I have problems reading and writing excel files with c++. But for now, I create a text document (.txt) and then rename it to .xls. And you can read and write to this file like it's a text file. This is one but a bad solution. When saving, you have to leave the format as it is and when exiting, you should click 'No' when asked to save. This works, but everything gets turned to text. The formulas disappear, leaving only the solution (in text format). I'm stuck with this method until I move on to Visual C++.
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Tutorial] GUI programming with FLTK dsmith FLTK Forum 10 03-Oct-2005 15:41
write a function in socket programming dxgn C++ Forum 0 07-Jan-2005 08:48
which language ? onauc C++ Forum 2 19-Nov-2004 02:53
this is from 6 files now i need fancy reports to write to the files kilgortrout C++ Forum 1 21-May-2004 16:57

Network Sites: GIDNetwork · GIDApp · GIDBlog · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 14:30.


vBulletin, Copyright © 2000 - 2014, Jelsoft Enterprises Ltd.