); //テンプレートのパスを取得 文字列=はのrealpath この .getClass()のgetResource( "/")ある、getPath()replaceFirstという( "/"、.. "" ); 文字列templateRealPath =のrealpath + "/テンプレート/インポートテンプレート* .XLS"; // フォルダ内のWebアプリケーション・テンプレート・ファイル ファイルエクセル= 新しい新しいファイル(templateRealPath); FileInputStreamのは、IS = ヌル; IS = 新しい新;のFileInputStream(エクセル) HSSFWorkbook WB = 新新HSSFWorkbook(IS); HSSFSheetシート = wb.getSheetAt(0); // 最初の HSSFFontフォント=wb.createFont(); font.setFontHeightInPoints((ショート)10 )。 font.setFontName( "宋体" ); HSSFCellStyleスタイル = wb.createCellStyle(); wb.write(response.getOutputStream())。 。response.getOutputStream()に近いです(); } キャッチ(にFileNotFoundException電子){ e.printStackTrace(); } キャッチ(IOExceptionを電子){ e.printStackTrace(); } }
ファイルのアップロードおよびダウンロード(a)のインポートテンプレートのダウンロード
おすすめ
転載: www.cnblogs.com/DarGi2019/p/12071294.html
ランキング