tags:

views:

675

answers:

5

Hi, i'm creating exel file and writing data just like writing notpad(text file) i have changed .txt as .xls file extension.i want bold letters in excel file how can i do that? plz help me. i have tried using jxl api,is every time i have to create label to when i want add ne label,cant i edit row and column of the lable?

Thanks guna

+9  A: 

You can use Apache POI for creating native binary xls files.

Or you can use JExcelApi which is another, and somewhat light-weight as far as I can remember, Java library for Excel.

huseyint
+2  A: 

Changing the extension of a file does not in any way change its contents. The extension is just a label.

If you want to work with Excel spreadsheets using Java, read up on the Apache POI library.

aberrant80
A: 

I used also JXLS: it receives the data as a Map and a template EXCEL with the correct syntax and return the file correctly populated. The data in every cell must be a JavaBean with visibility public.

It not worws if you must insert data in more than 1 sheet: in this case I used POI.

alepuzio
+2  A: 

Flat files do not allow providing meta information.

I would suggest writing out a HTML table containing the information you need, and let Excel read it instead. You can then use <b> tags to do what you ask for.

Thorbjørn Ravn Andersen
A: 

To create a spreadsheet and format a cell using POI, see the Working with Fonts example, and use:

font.setBoldweight(Font.BOLDWEIGHT_BOLD);

POI works very well. There are some things you can't do (e.g. create VBA macros), but it'll read/write spreadsheets with macros, so you can create a suitable template sheet, read it and manipulate it with POI, and then write it out.

Brian Agnew