Posted 22 November 2025, 7:12 am EST
Hello,
I’m trying to add an image to a comment in an Excel file programmatically. I’m using the following function:
[code]private static void addImageToCellComment(IRange cell, InputStream imageInputStream) throws IOException {
if (imageInputStream == null || imageInputStream.available() == 0) {
return;
}
// Optionally add a comment to indicate there's an image IComment comment = cell.addComment("Picture"); comment.getShape().getFill().userPicture(imageInputStream, ImageType.PNG); comment.getShape().setWidth(200); comment.getShape().setHeight(200); }[/code]
However, the image does not appear in the comment, and there are no error messages. I would appreciate any guidance or examples for getting this to work.
I’m working on the version 8.1.1
