Getting an excel file
-
hi to every one
how can i generate an excel file in my application?
thanks alot -
Not with standard Qt objects.
-
There is no way to do that in Qt itself.
However, you have a few options:- Generate a .csv file
- Use a third party library to generate a .xls or .xlsx
- Generate the xlsx by creating the necessary files your self and zipping them
For other solutions (like embedding MS Office through COM Objects) and links to specific libraries, look here:
"Discussions of Excel on the DevNet":http://developer.qt.nokia.com/search/tag/excel
"Discussions of Word on the DevNet":http://developer.qt.nokia.com/search/tag/word
"Discussions of CSV on the DevNet":http://developer.qt.nokia.com/search/tag/csv
-
how can i generate a .csv file?
-
There are a few tricks dealing with csv files.
First, you should have a read "here":http://en.wikipedia.org/wiki/Comma-separated_values
Then, you should ask yourself what kind of data you're trying to save and if it can contain symbols used in csv files.
If they don't you can just put all the data in a row seperated by a comma (or a semicolon).
If they do you'll have to wrap the fields in double quotes (") and replace all occurrences of double quotes in your data with double double quotes (""). -
Generate a CSV-File and convert it to Excel is the easiest way i think. Another way is: study the XLS-Format. Under "Wotsit":http://www.wotsit.org/list.asp?al=X you can find an explanation.
-
I have done it before. don't know that is a good way or not.
Just download "BasicExcell Library":http://www.codeproject.com/KB/office/BasicExcel.aspx create a new Qt library project, add source code of BasicExcel, and compile the library. Then include that library (on linux .so file) to your Qt project and you can read/write Excell files.
Note: I didn't use CSV, but write data directly from a MySQL database to xls file.
-
thanks alot