Find and replace program

Hello..

I would like to make a program which accesses two files, one is a spreadsheet file(.xls or .ods extension) and the other is a xml file.
Basically what the program does is just a find and replace program. The spreadsheet file would only contain values on two columns. Then the program will look-up values on the xml file and try to find the value on the first column then replace them with the values on the second column.

For example the spreadsheet has the following values on its 1st and 2nd column like below
1
2
3
4
1st Column  
dogs        
cats        
zebra  


1
2
3
4
2nd Column
blue
yellow
orange


and the xml file has a sentence like below

Inside the house has a lot of dogs and cats. But what will surprise you is that they also have a zebra.


So when you try to execute the program it will modify the xml file and replace the words --> dogs, cats, and zebra with the words on the 2nd column.
So the resulting sentence would be like

Inside the house has a lot of blue and yellow. But what will surprise you is that they also have a orange.


Can someone help me with this. I don't know how to start this since I'm a noob on programming and in fact C++ is my first programming language. And right now I'm only at the classes section of the tutorial here. I don't have any idea of how to access windows files.
So if possible can someone give me what commands will I try to learn so I can make an .exe that will execute this program.
I thought of asking this here cause I think the commands needed here is very simple that even a noob like me can easily learn,because it is just a find and replace program.
Last edited on
I don't know how to start this since I'm a noob on programming and in fact C++ is my first programming language.

Then you really jumped into the deep end with this one OP. MS Office is NOT where you want to start learning C++, least of all Excel, trust me on this. The Office namespace is targeted at Visual Basic, C# and possibly CLR (not that anyone cares about the last one). There is some functionality exposed to C++ by way of the WMI (the Windows Management Interface) but you're stuck interpreting the documentation from the context of another language which can get hairy given all of the nuances between them. It also requires the use of the COM (the Common Object Model) which is a separate learning curve on it's own, however it is not nearly as indecipherable as most people make it out to be.

My Humble Suggestions:

- If you know that you will be working a lot with Excel in the future then switch your focus over to VBS for a while. It is a brain dead easy scripting language to learn compared to C or C++ and it won't take you more then a few months of earnest effort to become an intermediate user with it. As a bonus, it does a decent job of showing you how the Windows OS is structured which will come in handy when you come back to C++ on this platform.

- If you are working with a generic spreadsheet, then ensure that the format is either .csv (comma separated value) or .tab (tab delimited). This will greatly simplify development by not using a packed file as your target.
ok thanks for the suggestion...
anyways I'll take your suggestion on using Visual Basic.
I know a little on visual basic since I also tried that but I immediately shifted on C++ since VB is more on drag here and there(not much on programming)..
Topic archived. No new replies allowed.