Managing Pictures

Aspose.Cells allows developers to add pictures to spreadsheets at runtime. Moreover, the positioning of these pictures can be controlled at runtime, which is discussed in more detail in the coming sections.

This article explains how to add pictures, and how to insert an image that shows the content of certain cells.

Adding Pictures

Adding pictures to a spreadsheet is very easy. It only takes a few lines of code.

Simply call the add method of the Pictures collection (encapsulated in the Worksheet object). The add method takes the following parameters:

  • Upper left row index, the index of the upper left row.
  • Upper left column index, the index of the upper left column.
  • Image file name, the name of the image file, complete with path.

Positioning of Pictures

Pictures can be positioned using Aspose.Cells as follows:

Absolute Positioning

Developers can position the pictures absolutely by using the setUpperDeltaX and setUpperDeltaY methods of the Picture object.

Advance topics

  • Insert a Linked Picture from Web Address
  • Insert a Picture based on Cell Reference
  • Insert Web Image from a URL into an Excel Worksheet