Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Image 在xlsx中添加PNG的异常-Apache POI 3.9_Image_Apache Poi_Xlsx - Fatal编程技术网

Image 在xlsx中添加PNG的异常-Apache POI 3.9

Image 在xlsx中添加PNG的异常-Apache POI 3.9,image,apache-poi,xlsx,Image,Apache Poi,Xlsx,我可以将PNG添加到xlsx中,但有一些异常情况:在最后一行(仅限),图像覆盖在前一行的图像上: 我怀疑锚定: int pictureIndex = report.addPicture(curve, XSSFWorkbook.PICTURE_TYPE_PNG); anchor.setCol1(7); **anchor.setRow1(rowNumber-1);** anchor.setCol2(8); anchor.setRow2(rowNumber);

我可以将PNG添加到xlsx中,但有一些异常情况:在最后一行(仅限),图像覆盖在前一行的图像上:

我怀疑锚定:

    int pictureIndex = report.addPicture(curve, XSSFWorkbook.PICTURE_TYPE_PNG);
    anchor.setCol1(7);
    **anchor.setRow1(rowNumber-1);**
    anchor.setCol2(8);
    anchor.setRow2(rowNumber);
    drawing.createPicture(anchor, pictureIndex);
但是如果我按照我所看到的例子,
anchor.setRow1(rowNumber)
那么我的图像根本不会显示

最后,有没有办法将图像放入单元格中(我想选择对该电子表格进行排序)


谢谢。

在尝试了
setCol
setRow
的许多排列之后,这最终奏效了:

anchor.setCol1(col);
anchor.setRow1(row);
anchor.setCol2(col + 1);
anchor.setRow2(row + 1);

你试过什么?我希望
anchor.setRow1(rowNumber);。。。anchor.setRow2(行编号+1)开始工作。但是“有没有办法将图像放入单元格?”:没有,图像以及其他形状悬浮在图纸上方的单独图层(图形)中,并且仅定位到单元格。