从java POI创建excel文件时出错

时间:2014-02-17 11:54:25

标签: java excel apache-poi

您好我想从java代码创建一个excel文件,我将此代码放在eclipse上但没有发生

import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;

import java.io.FileOutputStream;

public class TestPOI1 {

     public static void main(String[] args) {
         //create the new workbook
         Workbook workbook = new HSSFWorkbook();

         try {
                 //create the output stream to save the document on the hard drive
                 FileOutputStream output = new FileOutputStream("Test1.xls");

                 //write the file onto the hard drive
                 workbook.write(output);

                 //finish it up by closing the document
                 output.close();
         } catch(Exception e) {
                 e.printStackTrace();
         }   
    }        
}

在控制台中,此消息已写入

 Usage: BiffDrawingToXml [options] inputWorkbook Options:
 -exclude-workbook exclude workbook-level records
 -sheet-indexes output sheets with specified indexes
 -sheet-namek output sheets with specified name

我无法在硬盘驱动器或文件项目中找到我的excel文件。谢谢你的帮助。

0 个答案:

没有答案