This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
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


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
Author

How to write a file to a directory

Ashok Deivasigamani
Greenhorn

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
Sheriff

Joined: Oct 27, 2005
Posts: 20078
    
  30

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.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
 
Have you checked out Aspose?
 
subject: How to write a file to a directory
 
It's not a secret anymore!