1、导出加载图片
string imgusr = "D:/test/1.jpg" ;//图片路径
byte[] bytes = System.IO.File.ReadAllBytes(@imgusr);
int pictureIdx = workbook.AddPicture(bytes, NPOI.SS.UserModel.PictureType.JPEG);
HSSFPatriarch patriarch = (HSSFPatriarch)sheet1.CreateDrawingPatriarch();
HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 10, 40, k, rowIndex1, k + 1, rowIndex1 + 1);//rowIndex1行号,k为列号,10为高度,40为宽度
HSSFPicture pict = (HSSFPicture)patriarch.CreatePicture(anchor, pictureIdx);
// pict.Resize();//图片为实际高宽度
2、设置导出EXCEL宽度
sheet1.SetColumnWidth(2, 55 * 256);//sheet1的第二列设置为高55,宽256