Open rick-yang1987 opened 3 months ago
Can you share the code of how you add the image?
static Boolean InsertImage(XSSFWorkbook workbook, ISheet sheet, byte[] imageData, int row, int column, int endRows, int endCols) { try { XSSFCellStyle style = (XSSFCellStyle)workbook.CreateCellStyle(); style.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center; style.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center; XSSFDrawing patriarch = (XSSFDrawing)sheet.CreateDrawingPatriarch(); XSSFClientAnchor anchor = new XSSFClientAnchor(0, 0, 0, 0, column, row, endCols + 1, endRows + 1); anchor.AnchorType = AnchorType.MoveAndResize;
int pictureIndex = workbook.AddPicture(imageData, PictureType.BMP); XSSFPicture picture = (XSSFPicture)patriarch.CreatePicture(anchor, pictureIndex); picture.LineStyle = LineStyle.None; } catch (System.Exception ex) { return false; }
return true; }
461636174 @.***
------------------ 原始邮件 ------------------ 发件人: "nissl-lab/npoi" @.>; 发送时间: 2024年7月2日(星期二) 凌晨4:55 @.>; @.**@.>; 主题: Re: [nissl-lab/npoi] excel file damaged after adding images and saving (Issue #1352)
Can you share the code of how you add the image?
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>
NPOI Version
2.6.2
File Type
Upload the Excel File
项目资金预算(原文件).xlsx
Reproduce Steps
1、open file 2、add image 3、save
Issue Description