在导出的时候,把图片插入excel里面,但是图片要么是太大,或太小,要么就成个反的了。有没有谁能给我解释下poi里面HSSFClientAnchor里那八个参数的具体用法,不管我怎么调试都有问题。

解决方案 »

  1.   

    这个还真没 研究过,你去找找poi文档
      

  2.   

    public HSSFClientAnchor(int dx1,
                            int dy1,
                            int dx2,
                            int dy2,
                            short col1,
                            int row1,
                            short col2,
                            int row2)Creates a new client anchor and sets the top-left and bottom-right coordinates of the anchor. Parameters:
    dx1 - the x coordinate within the first cell.
    dy1 - the y coordinate within the first cell.
    dx2 - the x coordinate within the second cell.
    dy2 - the y coordinate within the second cell.
    col1 - the column (0 based) of the first cell.
    row1 - the row (0 based) of the first cell.
    col2 - the column (0 based) of the second cell.
    row2 - the row (0 based) of the second cell.
      

  3.   

    Creates a new client anchor and sets the top-left and bottom-right coordinates of the anchor.  
      

  4.   

    看看HSSFClientAnchor的父类怎么解释的
      

  5.   

    HSSFClientAnchor anchor = new HSSFClientAnchor(0,0,图片宽,图片高,列,行,列,行);
      

  6.   

    就是这里里面数字的定义,有什么规律的。怎么就可以不管有多少条数据,生成的图片都会自动放在最下面,不会遮住excel本身的那套数据。因为我导出的excel里面是有两套数据的,一套是直接用excel显示,还一套是以图片的方式显示。
      

  7.   

    我最近也在做这个,不过我们用的是  jxl
      

  8.   

    各位大哥大姐,怎么解决jfreechart生成的图片插入到excel的时候保证图片不失真啊?
      

  9.   

    哈哈 图片失真的问题已经解决了把patriarch.createPicture(anchor, wb.addPicture(byteArrayOut.toByteArray(), HSSFWorkbook.PICTURE_TYPE_JPEG));改成patriarch.createPicture(anchor, wb.addPicture(byteArrayOut.toByteArray(), HSSFWorkbook.PICTURE_TYPE_JPEG)).resize(1);
    就行了