Using String replace function to make sure the output file extension is .xls. Below is example code:
int rVal = c.showSaveDialog(SaveButton.this);
if (rVal == JFileChooser.APPROVE_OPTION) {
String str = c.getSelectedFile().getName();
_filename = str.replace(".xls", "");
_dir = c.getCurrentDirectory().toString();
_fullpath = _dir + "\\" + _filename + ".xls";
_file = new File(_fullpath);
No comments:
Post a Comment