[]
Workbook workbook = new Workbook();
IWorksheet worksheet = workbook.getActiveSheet();
byte[] imageBytes = java.util.Base64.getDecoder().decode(
"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+aF9sAAAAASUVORK5CYII=");
CellPicture picture = new CellPicture(imageBytes, "Company logo");
worksheet.getRange("A1").setCellPicture(picture);
CellPicture savedPicture = worksheet.getRange("A1").getCellPicture();
String altText = savedPicture.getAltText();
CellPicture(byte[] imageData) CellPicture class with the specified image data.CellPicture(byte[] imageData,
String altText) CellPicture class with the specified image data and alt text.byte[]voidsetAltText(String altText) CellPicture class with the specified image data. The provided array is copied, so subsequent changes to the input array do not affect this instance.imageData - The image binary data. Supported types: PNG, JPG, GIF, BMP, SVG.CellPicture class with the specified image data and alt text. The provided array is copied, so subsequent changes to the input array do not affect this instance.imageData - The image binary data. Supported types: PNG, JPG, GIF, BMP, SVG.altText - The alt text of the picture.
byte[] imageBytes = java.util.Base64.getDecoder().decode(
"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+aF9sAAAAASUVORK5CYII=");
worksheet.getRange("A1").setCellPicture(new CellPicture(imageBytes, "Company logo"));
CellPicture picture = worksheet.getRange("A1").getCellPicture();
byte[] copiedImageData = picture.getImageData();
CellPicture.
byte[] imageBytes = java.util.Base64.getDecoder().decode(
"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+aF9sAAAAASUVORK5CYII=");
worksheet.getRange("A1").setCellPicture(new CellPicture(imageBytes, "Company logo"));
CellPicture picture = worksheet.getRange("A1").getCellPicture();
String altText = picture.getAltText();
IRange.setCellPicture(CellPicture) to take effect.
java.util.function.Supplier<byte[]> imageDataProvider = () -> java.util.Base64.getDecoder().decode(
"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+aF9sAAAAASUVORK5CYII=");
byte[] imageBytes = imageDataProvider.get();
CellPicture picture = new CellPicture(imageBytes);
picture.setAltText("Company logo");
worksheet.getRange("A1").setCellPicture(picture);
altText - The alt text of the picture.