athrunwang

          紀元
          數據加載中……
          java操作excel 插入 讀取 備注 需要smartxls jar包
          import com.smartxls.CommentShape;
          import com.smartxls.WorkBook;

          public class CommentReadSample
          {

              public static void main(String args[])
              {

                  WorkBook workBook = new WorkBook();
                  try
                  {
                      workBook.read("..\\template\\book.xls");

                      // get the first index from the current sheet
                      CommentShape commentShape = workBook.getComment(1, 1);
                      if(commentShape != null)
                      {
                          System.out.println("comment text:" + commentShape.getText());
                          System.out.println("comment author:" + commentShape.getAuthor());
                      }
                  }
                  catch (Exception e)
                  {
                      e.printStackTrace();
                  }
              }
          }

          import com.smartxls.WorkBook;

          public class CommentWriteSample
          {

              public static void main(String args[])
              {
                  WorkBook workBook = new WorkBook();
                  try
                  {
                      //add a comment to B2
                      workBook.addComment(1, 1, "comment text here!", "author name here!");

                      workBook.write(".\\comment.xls");
                  }
                  catch (Exception e)
                  {
                      e.printStackTrace();
                  }
              }
          }

          posted on 2011-12-28 19:01 AthrunWang 閱讀(719) 評論(0)  編輯  收藏


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


          網站導航:
           
          主站蜘蛛池模板: 奈曼旗| 垫江县| 红安县| 若羌县| 桐乡市| 揭西县| 台湾省| 张家口市| 田阳县| 比如县| 收藏| 库伦旗| 德兴市| 上饶市| 龙岩市| 北安市| 如皋市| 边坝县| 鹤山市| 镇赉县| 辉南县| 察雅县| 鄄城县| 阿瓦提县| 卓资县| 平武县| 巴彦淖尔市| 峡江县| 盖州市| 新化县| 五河县| 海南省| 静乐县| 将乐县| 雷山县| 雅安市| 白玉县| 静海县| 景东| 莎车县| 体育|