Managing Pictures
Contents
[
Hide
]
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.
Aspose.Cells for Java only supports image formats: BMP, JPEG, PNG, GIF.
Indexes used in examples start from 0.
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.