tags:

views:

54

answers:

3

Hi, how to save output in excel format rather than in .txt file?

+2  A: 

Apache POI

Mihir Mathuria
+1 for answering as vague and wordless as the question :) fitting.
guitarthrower
+1  A: 

A great alternative to an actual excel file is a CSV file which stands for Comma Separated Values. Basically you output your data as follows:

First Name, Last Name, Birthday
Joe, Smith, 10/10/78
Matt, Jones, 2/2/90

With commas between each column, and newlines after each row. If your data has commas in it, you can enclose the data in quotes.

Excel has very good support for loading csv files, and you can even use them as a linked data source in an excel file, and then reference the data from other sheets for graphing, calculations, and pivot tables.

Farnk
Thanks you ....
Jessy
This is good advice on one level- outputting csv may be the easiest way to do what you want. But please use a third party library to output it unless your data is very simple. Csv is a surprisingly tricky format to work with, and you're very likely to go wrong if you decide to produce it yourself.
T Duncan Smith
A: 

or JExcelAPI

liya