首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

创设workbook

2012-12-25 
创建workbook?? public static Workbook createWorkbookByFile( String excelFileName )??????????? throw

创建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;
??? }

热点排行