Add pictures to exists Excel file with pictures

Feb 14, 2013 at 5:24 AM
Edited Feb 14, 2013 at 5:30 AM
After I add some pictures to an Excel file with old pictures, I can see the new added pictures, but I cannot see the old pictures. Is there any solution to fix it?

private void WriteItem(HSSFRow row,QuotationDS.ItemRow itemRow)
{
        if (this.NameHead != null)
        {
            row.GetCell(this.NameHead.ColumnIndex).SetCellValue( itemRow.Name );
        }

        if (this.PhotoHead != null && !itemRow.IsPhotoNull())
        {
            int pictureIdx = this._workbook.AddPicture(itemRow.Photo, PictureType.PNG);

            HSSFPatriarch patriarch = this.Patriarch;

            HSSFClientAnchor anchor = new HSSFClientAnchor(
                5, 5, 1023-5, 255-5, 
                this.PhotoHead.ColumnIndex, 
                row.RowNum, 
                this.PhotoHead.ColumnIndex,
                row.RowNum);
            anchor.AnchorType = 2;
            patriarch.CreatePicture(anchor, pictureIdx);
        }

        //.. output other fields
        //
}
Coordinator
Mar 1, 2013 at 10:28 PM
Which version of NPOI are you using? 1.2.5 or 2.0?
Mar 21, 2013 at 3:54 PM
Tony, how would I go about checking my version? I am having a very similar issue.

Thanks,
Carl
Mar 27, 2013 at 2:47 AM
I have fixed this problem by using 2.0.