Pomster
Pomster

Reputation: 15197

Place picture into spread sheet to fill the whole cell (Merged cells)

Hi i am using EPPlus to populate a spreadsheet with data, so far so good text wise but i am having issues when trying to add a picture??

I can add a picture but its from the top left cell and its not contained with in a cell.

Please could someone show me how i can place a picture into a cell and fill the cell?

 Bitmap image = new Bitmap(tempFolderPathAlt + "ExtractedFiles/" + ArrayNode[i].TagValue);
 ExcelPicture picture = null;
 var rowIndex = xlWorkSeet1[k].Dimension.Start.Row;
 var columnIndex = xlWorkSeet1[k].Dimension.Start.Column;
 picture = xlWorkSeet1[k].Drawings.AddPicture(System.Guid.NewGuid().ToString() + rowIndex.ToString() + columnIndex.ToString(), image);
 picture.From.Column = columnIndex;
 picture.From.Row = rowIndex;

Upvotes: 2

Views: 992

Answers (1)

user1125572
user1125572

Reputation: 56

I believe there is no way to add a picture into a cell. The work around for this is to resize the cell to be the same size as your image and place it over the cell.

Upvotes: 1

Related Questions