Make sure you are looking at the right text file. I suggest you delete the one in your src folder, run the program and see if it gets recreated. If so see what's in it. If not check the project's root directory as that is where I would expect to see it.
I tried opening an 2010 Excel file by writing:
BufferedWriter writer = new BufferedWriter(new FileWriter("file.xls"));
It ends up opening a Microsoft Works spreadsheet instead of an Office 2010 Excel file. When I try the extension, ".xlsx", it creates a 2010 excel file. The problem is I get an error when I try to open the file saying that it is the wrong file extension.
I would be grateful for any help!
Regards,
jetski100
Last edited by jetski100; October 8th, 2011 at 12:56 PM.
It ends up opening a Microsoft Works spreadsheet instead of an Office 2010 Excel file.
That's down to the file associations on your computer.
The problem is I get an error when I try to open the file saying that it is the wrong file extension.
An Excel .xlsx file is a pretty complex file. It's actually a zip of several XML files. You can't just write some plain text to a file give it a .xlsx extension and expect Excel to be able to open it.
Bookmarks