You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
IWorkbook workbook = new SXSSFWorkbook();
ISheet sheet = workbook.CreateSheet("Sheet1");
byte[] imageBytes = File.ReadAllBytes("lock.png");
int pictureIndex = workbook.AddPicture(imageBytes, PictureType.PNG);
IDrawing drawing = sheet.CreateDrawingPatriarch();
ICreationHelper helper = workbook.GetCreationHelper();
IClientAnchor anchor = helper.CreateClientAnchor();
// Set the top-left corner of the image
anchor.Col1 = 1;
anchor.Row1 = 1;
anchor.AnchorType = AnchorType.DontMoveAndResize;
IPicture picture = drawing.CreatePicture(anchor, pictureIndex);
picture.Resize(); // This will resize the picture to its original size
using (FileStream fileStream = new FileStream("D:\\testexcel.xlsx", FileMode.Create, FileAccess.Write))
{
workbook.Write(fileStream);
}
Issue Description
In the latest version inserting an image and using .Resize() with the intention to resize the image to its original size in an excel workbook (both XSSF and SXSSF) is not working anymore. The image stays very small. I have a attached the sample code with which to reproduce.
The text was updated successfully, but these errors were encountered:
NPOI Version
2.7.2
File Type
Checked with XLSX and XLS
Upload the Excel File
testexcel.xlsx
Reproduce Steps
Issue Description
In the latest version inserting an image and using .Resize() with the intention to resize the image to its original size in an excel workbook (both XSSF and SXSSF) is not working anymore. The image stays very small. I have a attached the sample code with which to reproduce.
The text was updated successfully, but these errors were encountered: