1)
//Instantiating an Workbook object
Workbook workbook = new Workbook(“e:\test2\Book1.xlsx”);
//Obtaining the reference of first worksheet by passing its sheet index
Worksheet worksheet = workbook.Worksheets[0];
//Adding a picture at the location of a cell whose row and column indices
//are 5 in the worksheet. It is “F6” cell
int pictureIndex = worksheet.Pictures.Add(5, 5, “e:\test\chartimage.jpg”);
//Accessing the newly added picture
Aspose.Cells.Drawing.Picture picture = worksheet.Pictures[pictureIndex];
//Positioning the picture proportional to row height and colum width
picture.UpperDeltaX = 200;
picture.UpperDeltaY = 200;
picture.LowerDeltaX = 200;
picture.LowerDeltaY = 200;
//Saving the Excel file
workbook.Save(“e:\test2\picturesposit.xls”);
2)
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
worksheet.Cells.SetRowHeight(3, 120);
worksheet.Cells.SetColumnWidth(6, 20);
//Fit to G4 cell.
int index = worksheet.Pictures.Add(3, 6, 4, 7, “e:\test\school.jpg”);
Aspose.Cells.Drawing.Picture pic = worksheet.Pictures[index];
pic.Placement = PlacementType.FreeFloating;
workbook.Save(“e:\test2\pichw2.xls”);