File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes I/O and Streams and the fly likes How to write a file to a directory Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "How to write a file to a directory" Watch "How to write a file to a directory" New topic

How to write a file to a directory

Ashok Deivasigamani

Joined: Dec 08, 2007
Posts: 1
Guys I had created a xls file in java using the Java Excel API in my java code,
I don't know how to write the file to a directory location in my computer, so that I can open the file and see the actual content of the xls file that I have created using the follwing code

WritableWorkbook workBook = Workbook.createWorkbook(new File("ExcelOut.xls"));

Rob Spoor

Joined: Oct 27, 2005
Posts: 19649

You need to call both workBook.write() and workBook.close() (in that order). Forgetting to call close() will still create a 0 byte file. Forgetting to call write() creates an invalid Excel file.

How To Ask Questions How To Answer Questions
Don't get me started about those stupid light bulbs.
subject: How to write a file to a directory
Similar Threads
Writing a content in excel in incremental way
JExelApi read formulaNumberValue
Using JXL to edit an existing excel sheet withe new data
transfer data between Excel sheets
Cross referencing of excel sheets in jxl