I'm trying to understand how one might go about building a program with a spreadsheet widget and being able to save the data in that spreadsheet? (Just Conceptually).
The basic aim here is to input data on a regular basis using a C++ GUI of some kind and having that data there when I come back in a week or more for example.

How might I go about this. Do I need a separate database connected to C++ or is there a specific concept here that I need to understand to enable me to do something like this?

(yes I have excel but I want to do this in C++)

Thanks very much.

Recommended Answers

All 4 Replies

What you are asking is somewhat advanced. Data entry in the form of something like a spreadsheet is accomplished through 'grids', which are usually Windows custom controls, although if you are working with .NET there are ones available. Of course, we're talking GUIs here - not console programs. So I'm not sure what level you are at in your C++ endeavors.

If by chance you want something like that in a console mode setting - that is rather complivated also, by the way.

However, having created a GUI application and put a grid control on it and set the numbers of columns and rows you want, you could then enter data. Having done that your next step is to 'persist' the data in some form, i.e., simple flat files, a database, whatever. Have I answered your question?

Do you mean you want to input a set of data, and then output to excel spreadsheet?

If so i did something like this before, you can use fstream to outfile with file extension *.csv. Use comma to next column and endline to next row.

Thanks Frederick2 and murnesty. I was specifically interested in entering data into a C++ Gui and then storing the data in some kind of a makedo C++ D'base. I thought there would be something that is commonly used in C++ such as a C++ D'base.

I think the term Frederick2 explains it well. To 'Persist' data. That's exactly what I'm talking about. I would assume that instead of storing the data in a C++ app you would have an external database and communicate with it using SQL. That's only based on my vuage intuitive understanding of how to go about something like this.

Any other comments are welcomed. Thanks for the feedback so far.


You could certainly use a SQL database. There's no real concept of a C++ d'base, specifically. Instead, you might just want to start with reading/writing a simple text file, as murnesty suggested -- one line per row in your table, and elements in the row separated by comma (or any other character that doesn't show up in your actual data -- you will have all kinds of problems if you try to separate columns by commas and then have commas in your data -- there are workarounds, but the headaches for a relatively new programmer aren't worth it!)

As far as a GUI (graphical user interface), I've been working with Qt for a while now and am quite happy with it. It makes displaying and editing the data in a grid-style table very simple, but the object-oriented nature of separating the data "model" from the "view" can take quite a bit of getting used to! There are other GUI APIs as well, wxWidgets is one which is widely used in Windows and cross-platform.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.