title: Insert an image to cell by NPOI
body: <p>I am using NPOI to generate excel file. My requirement is insert an image to cell. However i having a problem nw. How can i insert an image in only one cell by using NPOI?Did anyone solve this trouble before?</p>
  
  <pre><code>  protected void Button1_Click(object sender, EventArgs e)
      {
          InitializeWorkbook();
          ISheet sheet1 = hssfworkbook.CreateSheet("PictureSheet");
  
  
          HSSFPatriarch patriarch = (HSSFPatriarch)sheet1.CreateDrawingPatriarch();
  
          //create the anchor
          HSSFClientAnchor anchor;
          anchor = new HSSFClientAnchor(0, 0, 0, 255, 2, 2, 4, 6);
          anchor.AnchorType = 0;
  
  
  
  
          picture.LineStyle = HSSFPicture.OBJECT_TYPE_LINE;
          WriteToFile();
      }
  
      private  int LoadImage(string path, HSSFWorkbook wb)
      {
  
          FileStream file = new FileStream(path, FileMode.Open, FileAccess.Read);
          byte[] buffer = new byte[file.Length];
          file.Read(buffer, 0, (int)file.Length);
          return wb.AddPicture(buffer, PictureType.JPEG);
  
      }
  </code></pre>