Results 1 to 1 of 1
- 06-05-2011, 09:10 PM #1Member
- Join Date
- Apr 2011
- Rep Power
Downloading excel file with valid field format.
In my application, we have an option to download the excel file.
At implementation level :
Whenever a user clicks to download, the file data is retrieved from database and directly written into a excel file due to this all the data written into the file is in string format.
Excel file contains columns like date or amount. When user wants to have SUM/Avg of amount, then its not possible since the data type of amount is string instead of integer or float.
As per my knowledge, query accesses many tables and it will be difficult to retrieve data type of the each field selected.
Since, I know which are the fields will be written to a excel, I am thinking of hard coding the data type of the fields while writing to excel.
Most of the fields are of String data type (i.e Varchar and char).
Some fields are integer, currency and date.
We are using Java 1.4 and need to deal with multiple java files since we have different downloads.
1. Have a properties file with field names as value comma separated and data type as key.
2. Have a String with field names in the respective class.
So, whenever we retrieve data from data base we can check for the field names and compare these field values with the properties file (containing field names comma separated) and if matches, pass the key to a method which takes care of writing to a excel file.
Please let me know which is the better option or if any other option.
- By gita in forum Advanced JavaReplies: 1Last Post: 02-02-2011, 06:39 AM
- By newbiejava in forum New To JavaReplies: 16Last Post: 09-04-2010, 05:03 AM
- By jojo in forum Advanced JavaReplies: 2Last Post: 12-16-2009, 12:04 AM
- By rlaknar in forum JavaServer Pages (JSP) and JSTLReplies: 1Last Post: 07-13-2009, 10:15 AM
- By saran123 in forum JDBCReplies: 1Last Post: 10-10-2008, 09:47 AM