wpf-16407-controls-and-libraries-spreadsheet-examples-pictures-how-to-modify-embedded-picture.md
This example uses the Shape properties to modify a picture inserted in a worksheet.
// Set the measurement unit to Millimeter.
workbook.Unit = DevExpress.Office.DocumentUnit.Millimeter;
workbook.BeginUpdate();
try
{
Worksheet worksheet = workbook.Worksheets[0];
// Insert pictures from the file.
Picture pic = worksheet.Pictures.AddPicture("Pictures\\chart.png", worksheet.Cells["A1"]);
worksheet.Pictures.AddPicture("Pictures\\candles.png", worksheet.Cells["D5"]);
// Specify picture name and draw a border.
pic.Name = "Candles";
pic.AlternativeText = "Candles snapshot";
pic.BorderWidth = 1;
pic.BorderColor = DevExpress.Utils.DXColor.Black;
// Move a picture.
pic.Move(20, 30);
// Change picture behavior so it will move and size with underlying cells.
pic.Placement = Placement.MoveAndSize;
worksheet.Rows[5].Height += 10;
worksheet.Columns["D"].Width += 10;
// Specify rotation angle.
pic.Rotation = 30;
// Increase rotation angle.
pic.IncrementRotation(-30);
// Add a hyperlink.
pic.InsertHyperlink("https://www.devexpress.com/", true);
worksheet.Shapes[1].InsertHyperlink("https://www.devexpress.com/Products/NET/Controls/WPF/", true);
}
finally
{
workbook.EndUpdate();
}
' Set the measurement unit to Millimeter.
workbook.Unit = DevExpress.Office.DocumentUnit.Millimeter
workbook.BeginUpdate()
Try
Dim worksheet As Worksheet = workbook.Worksheets(0)
' Insert pictures from the file.
Dim pic As Picture = worksheet.Pictures.AddPicture("Pictures\chart.png", worksheet.Cells("A1"))
worksheet.Pictures.AddPicture("Pictures\candles.png", worksheet.Cells("D5"))
' Specify picture name and draw a border.
pic.Name = "Candles"
pic.AlternativeText = "Candles snapshot"
pic.BorderWidth = 1
pic.BorderColor = DevExpress.Utils.DXColor.Black
' Move a picture.
pic.Move(20, 30)
' Change picture behavior so it will move and size with underlying cells.
pic.Placement = Placement.MoveAndSize
worksheet.Rows(5).Height += 10
worksheet.Columns("D").Width += 10
' Specify rotation angle.
pic.Rotation = 30
' Increase rotation angle.
pic.IncrementRotation(-30)
' Add a hyperlink.
pic.InsertHyperlink("https://www.devexpress.com/", True)
worksheet.Shapes(1).InsertHyperlink("https://www.devexpress.com/Products/NET/Controls/WPF/", True)
Finally
workbook.EndUpdate()
End Try