请问:下边的代码如何使导出的是excel?谢谢!!

class DumpTableChooser extends JFileChooser {

private MainFrame mainFrame;

private Database db;

public DumpTableChooser(MainFrame mainFrame, Database db) {
    this.mainFrame = mainFrame;
    this.db = db;
    this.setFileSelectionMode(DIRECTORIES_ONLY);
}

public void approveSelection() {
    File file = this.getSelectedFile();
    if (file.isDirectory()) {
        //用户选择了目录
        File targetFile = new File(file.getAbsolutePath() + File.separator + //File.separator =\
                this.db.getDatabaseName() + ".xls");//getAbsolutePath():返回抽象路径名的绝对路径名字符串
        this.mainFrame.executeDumpTable(targetFile, this.db);
    } else {
        this.mainFrame.executeDumpTable(file, this.db);
    }
    super.approveSelection();
}

}

看不出来,核心代码在executeDumpTable里面

你把数据写入csv格式文件就可以了,excel可以支持打开