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

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

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

    隨筆 - 6  文章 - 129  trackbacks - 0
    <2025年5月>
    27282930123
    45678910
    11121314151617
    18192021222324
    25262728293031
    1234567

    常用鏈接

    留言簿(14)

    隨筆檔案(6)

    文章分類(467)

    文章檔案(423)

    相冊

    收藏夾(18)

    JAVA

    搜索

    •  

    積分與排名

    • 積分 - 825738
    • 排名 - 49

    最新評論

    閱讀排行榜

    評論排行榜

    部分代碼如下(POI的版本為3.2)
    public void insertRow() throws IOException {

          POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream("workbook.xls"));
           HSSFWorkbook wb = new HSSFWorkbook(fs);
           HSSFSheet sheet = wb.getSheet("new sheet");
          int starRow = 4;
          int rows = 5;
         
            sheet.shiftRows(starRow + 1, sheet.getLastRowNum(), rows,true,false);
            //Parameters:
            //startRow - the row to start shifting
            //endRow - the row to end shifting
            //n - the number of rows to shift
            //copyRowHeight - whether to copy the row height during the shift
            //resetOriginalRowHeight - whether to set the original row's height to the default
          
            starRow = starRow - 1;

            for (int i = 0; i < rows; i++) {
             HSSFRow sourceRow = null;
             HSSFRow targetRow = null;
             HSSFCell sourceCell = null;
             HSSFCell targetCell = null;
             short m;
             starRow = starRow + 1;
             sourceRow = sheet.getRow(starRow);
             targetRow = sheet.createRow(starRow + 1);
             targetRow.setHeight(sourceRow.getHeight());
     
             for (m = sourceRow.getFirstCellNum(); m < sourceRow.getLastCellNum(); m++) {
             sourceCell = sourceRow.getCell(m);
             targetCell = targetRow.createCell(m);
     
             //targetCell.setEncoding(sourceCell.getEncoding());
             targetCell.setCellStyle(sourceCell.getCellStyle());
             targetCell.setCellType(sourceCell.getCellType());
             targetCell.setCellValue(i);//設置值
             }
           }
         FileOutputStream fileOut = new FileOutputStream("workbook.xls");
            wb.write(fileOut);
            fileOut.close();
       }

    參考了http://blog.csdn.net/daemon_boy/archive/2007/09/15/1786384.aspx的代碼

    posted on 2009-04-16 16:43 Ke 閱讀(10809) 評論(0)  編輯  收藏 所屬分類: java excel

    只有注冊用戶登錄后才能發(fā)表評論。


    網(wǎng)站導航:
     
    主站蜘蛛池模板: avtt天堂网手机版亚洲| 国产亚洲视频在线观看网址| 怡红院免费的全部视频| 亚洲精品456播放| 亚洲欧美在线x视频| 四虎影视精品永久免费网站| 亚洲国产精品综合久久一线| 成a人片亚洲日本久久| 国产免费人视频在线观看免费| 国产精品亚洲小说专区| 一级毛片直播亚洲| 国产黄在线播放免费观看| 亚洲综合av永久无码精品一区二区| 亚洲男女一区二区三区| 国产大陆亚洲精品国产| 国产99视频免费精品是看6| 一区二区三区AV高清免费波多| 无遮免费网站在线入口| 亚洲成AV人在线观看天堂无码| 国产免费AV片在线观看| 亚洲综合久久1区2区3区| 一个人免费观看视频www| 国产精品亚洲а∨天堂2021| 亚洲一区无码精品色| 精品成人一区二区三区免费视频| 亚洲精品高清一二区久久| 最近的2019免费中文字幕| 77777_亚洲午夜久久多人| 免费在线黄色电影| 亚洲精品无码激情AV| 久久精品国产这里是免费| 亚洲无圣光一区二区| 又粗又黄又猛又爽大片免费| 在线免费观看伊人三级电影| 亚洲日韩乱码中文无码蜜桃| 国产a不卡片精品免费观看| 久久精品免费一区二区三区| 亚洲AV综合色区无码二区爱AV| 亚洲视频在线免费| 国产精品久久免费| 一区二区三区免费在线观看|