views:

79

answers:

2

I was wondering what the easiest way to write a simple form program or web page that will output to a text file that can be opened in excel easily. I know how to write in C++ but I dont know any GUI and I wanted a simple form. I was thinking I could just write an HTML/PHP page but it has to be able to run without the internet, but I dont know if you can have a web page append to a file in a folder. Can anyone point me into a direction to do this?

+1  A: 

PHPExcel: Create .xlsx spreadsheets using php. http://phpexcel.codeplex.com/

You can make a standard HTML form and use php to generate the excel file. However you said one of your requirements was being able to run without the internet, so unless your user has php installed this solution isn't so good for you.

As you pointed out, almost anything can be opened with Excel, so perhaps you can generate a delimited txt file using JavaScript. That would certainly run offline and not require any additional software to be installed by the user.

Edit: Here's a link to an article about writing to files in JavaScript. Very easy if you're not looking to code an actual application and use HTML, which would have maximum machine compatibility. http://www.tek-tips.com/viewthread.cfm?qid=1171273&page=1

ryangavin
So you can output to a local file with javascript because I can work with that?
shinjuo
+4  A: 

If you want a Windows based application, and you can code in C++, then possibly the simplest route is to get hold of Visual Studio (you can get the Express versions for free), and write something using your language of choice.

Basic GUI stuff in Visual Studio is simple enough. You can then write your output either to a delimited text file (like a CSV), or use the Excel Object Model if you want to create an actual Excel spreadsheet - although that might be overkill if the data are simple.

You might find this question useful too (it's about Word documents, but some of the concepts and pitfalls are the same):

http://stackoverflow.com/questions/3119666/programmatically-generating-editable-word-docs-from-asp-net

Installing PHP and creating an HTML page is perfectly possible, but it seems like a lot of effort. You should search Stackoverflow for PHP Excel, as you may find some other useful stuff here.

In what environment will the form/application be run?

Mike
Windows Computer
shinjuo