Error With creating an excel file from java POI

牧云@^-^@ 提交于 2019-12-20 05:45:34

问题


Hi I would like to create an excel file from a java code, I put this code on eclipse but nothing happen

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();
         }   
    }        
}

in the console, this message is written

 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

and I can't found my excel file in the hard drive or in the file project. thanks for help.

来源:https://stackoverflow.com/questions/21828403/error-with-creating-an-excel-file-from-java-poi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!