创建workbook

   public static Workbook createWorkbookByFile( String excelFileName )
            throws ExportException
    {
        Assert.Arg.notNull( excelFileName, "excelFileName" );

        FileInputStream ins = null;
        Workbook wb = null;
        try
        {
            ins = new FileInputStream( excelFileName );
            wb = WorkbookFactory.create( ins );
        } catch ( Exception e )
        {
            // LOG.error( "Failed to open template file!" + templateFileName);
            throw new ExportException( "Failed to open template file!"
                    + excelFileName + e.toString() );
        } finally
        {
            if ( ins != null )
            {
                try
                {
                    ins.close();
                } catch ( IOException e )
                {
                    LOG
                            .error( "Failed to close template file!"
                                    + excelFileName, e );
                }
            }
        }
        return wb;
    }

你可能感兴趣的:(OO)