<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    jsp導(dǎo)出excel文件,使用POI的

    Posted on 2006-10-25 17:55 Hally 閱讀(8216) 評(píng)論(4)  編輯  收藏 所屬分類: 學(xué)習(xí)隨筆

    ?


    <% @?page?language = " java " ?contentType = " text/html;charset=gb2312 " %>
    <% @?page?language = " java "
    ????
    import = " java.util.*,org.apache.poi.hssf.usermodel.HSSFWorkbook,org.apache.poi.hssf.usermodel.HSSFSheet,org.apache.poi.hssf.usermodel.HSSFRow,org.apache.poi.hssf.usermodel.HSSFCell " %>
    <%
    ????response.setContentType(
    " APPLICATION/OCTET-STREAM " );
    ????response.setHeader(
    " Content-Disposition " ,
    ????????????
    " attachment;?filename=\ " test.xls " ?+

    ????????????
    " \ "" );

    ????HSSFWorkbook?wb?
    = ? new ?HSSFWorkbook();
    ????HSSFSheet?sheet?
    = ?wb.createSheet( " sheet1 " );

    ????
    // 以下以寫表頭
    ????
    // 表頭為第一行
    ????HSSFRow?row? = ?sheet.createRow(( short )? 0 );

    ????HSSFCell?cell1?
    = ?row.createCell(( short )? 0 );
    ????HSSFCell?cell2?
    = ?row.createCell(( short )? 1 );
    ????HSSFCell?cell3?
    = ?row.createCell(( short )? 2 );

    ????cell1.setEncoding((
    short )? 1 );
    ????cell1.setCellType(
    1 );
    ????cell2.setEncoding((
    short )? 1 );
    ????cell2.setCellType(
    1 );
    ????cell3.setEncoding((
    short )? 1 );
    ????cell3.setCellType(
    1 );

    ????
    // 定義表頭的內(nèi)容
    ????cell1.setCellValue( " 測(cè)試 " );
    ????cell2.setCellValue(
    " 測(cè)試2 " );
    ????cell3.setCellValue(
    " 測(cè)試3 " );

    ????
    for ?( int ?i? = ? 0 ;?i? < ? 4 ;?i ++ )? {
    ????????
    // 定義數(shù)據(jù)從第二行開始???????
    ????????row? = ?sheet.createRow(( short )?i? + ? 1 );
    ????????cell1?
    = ?row.createCell(( short )? 0 );
    ????????cell2?
    = ?row.createCell(( short )? 1 );
    ????????cell3?
    = ?row.createCell(( short )? 2 );

    ????????cell1.setEncoding((
    short )? 1 );
    ????????cell1.setCellType(
    1 );
    ????????cell2.setEncoding((
    short )? 1 );
    ????????cell2.setCellType(
    1 );
    ????????cell3.setEncoding((
    short )? 1 );
    ????????cell3.setCellType(
    1 );

    ????????
    // 填充內(nèi)容

    ????????cell1.setCellValue(
    " ggg " );
    ????????cell2.setCellValue(
    " 00000 " );
    ????????cell3.setCellValue(
    " adfasdf " );

    ????}

    ????wb.write(response.getOutputStream());
    ????response.getOutputStream().flush();
    ????response.getOutputStream().close();
    %>

    Feedback

    # re: jsp導(dǎo)出excel文件,使用POI的  回復(fù)  更多評(píng)論   

    2006-10-25 18:04 by Hally
    poi 下載地址

    http://jakarta.apache.org/site/downloads/downloads_poi.cgi

    # re: jsp導(dǎo)出excel文件,使用POI的  回復(fù)  更多評(píng)論   

    2007-07-11 13:06 by adfasdf
    afasfasfd

    # re: jsp導(dǎo)出excel文件,使用POI的  回復(fù)  更多評(píng)論   

    2008-05-25 20:47 by eter
    @adfasdf

    # re: jsp導(dǎo)出excel文件,使用POI的  回復(fù)  更多評(píng)論   

    2009-03-02 14:22 by wangdong
    頂呀,搞出來是亂碼

    posts - 43, comments - 200, trackbacks - 0, articles - 2

    Copyright © Hally

    主站蜘蛛池模板: 日韩毛片无码永久免费看| 中文字幕亚洲色图| 亚洲乱码中文字幕手机在线| 亚洲黄片手机免费观看| 午夜免费福利在线| 亚洲91精品麻豆国产系列在线| 日本一道综合久久aⅴ免费| 中文字幕免费在线播放| 亚洲精品无码国产| 国产免费黄色无码视频| 亚洲成a人片在线观| 亚洲人成网站18禁止一区 | 成熟女人特级毛片www免费| WWW国产成人免费观看视频| 亚洲女人初试黑人巨高清| 免费吃奶摸下激烈视频| 每天更新的免费av片在线观看| 美女视频黄.免费网址| 免费国产a国产片高清网站| 午夜影院免费观看| 日本高清不卡中文字幕免费| 亚洲精品国产啊女成拍色拍| 18禁美女黄网站色大片免费观看| 老子影院午夜伦不卡亚洲| 亚洲精品视频在线免费| 久久久久亚洲?V成人无码| 女性自慰aⅴ片高清免费| 91精品国产免费| 两个人看的www免费高清| 久久亚洲精品11p| 色久悠悠婷婷综合在线亚洲| 可以免费看的卡一卡二| 嫩草成人永久免费观看| 成人在线免费视频| 亚洲AV成人无码久久精品老人| 免费一级毛片不卡不收费| 成人免费毛片内射美女-百度| 久久99热精品免费观看动漫| h片在线观看免费| 一区二区三区精品高清视频免费在线播放| 亚洲av乱码一区二区三区|