NPOI
NPOI copied to clipboard
AnchorType.MoveDontResize does not work correctly when we set custom row height
When I change row height the image height also grows. My code is as the following:
private void AddImageToWorkBook(Image img, int colIndex, int rowIndex, XSSFWorkbook workbook, ISheet sheet) { var ms = new MemoryStream(); img.Save(ms, ImageFormat.Png); byte[] data = ms.ToArray(); int pictureIndex = workbook.AddPicture(data, PictureType.PNG); ICreationHelper helper = workbook.GetCreationHelper(); IDrawing drawing = sheet.CreateDrawingPatriarch(); IClientAnchor anchor = helper.CreateClientAnchor(); anchor.AnchorType = AnchorType.MoveDontResize; anchor.Col1 = colIndex;//0 index based column anchor.Row1 = rowIndex;//0 index based row IPicture picture = drawing.CreatePicture(anchor, pictureIndex); picture.Resize(); }
When I change the row height before or after calling this function, then the generated image will grow too while I've set the AnchorType to MoveDontResize. Expected behavior: Image size should not grow with row height.