This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Other Open Source Projects and the fly likes Writing to EXCEL -- Workbook.write() not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Writing to EXCEL -- Workbook.write() not working" Watch "Writing to EXCEL -- Workbook.write() not working" New topic
Author

Writing to EXCEL -- Workbook.write() not working

Priya Sri
Ranch Hand

Joined: Mar 30, 2004
Posts: 84
Hi all,

I am trying to write some data to an excel using the below code. The data in MyExcel1 can be found in the variable "copy". But is not getting written to MyExcel2.xls
Please help !!



Regards,
Priya Sri
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41587
    
  54
It doesn't look like the code writes to MyExcel2.xls. It writes to whatever is returned in line 2. I'm not sure what that would be - java.util.File has no method called createTempFile(String).


Ping & DNS - my free Android networking tools app
Priya Sri
Ranch Hand

Joined: Mar 30, 2004
Posts: 84
Very sorry...the code there is actually like this:
excelFile = File.createTempFile("MyExcel1", ".xls",new File("C:\"));
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41587
    
  54
OK, so that confirms it - nothing would get written to MyExcel2.xls.

Why are you using createTempFile instead of "new File"?
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Writing to EXCEL -- Workbook.write() not working