Example
The following example loads a picture in a picture cell and when the user clicks a button, saves the picture to a file.
C++
BOOL COCXpropertiesDlg::OnInitDialog()
{
m_Spread.SetCol(1);
m_Spread.SetRow(1);
// Create a picture cell type
m_Spread.SetCellType(9);
// Load picture
CPicture picture(m_Spread.LoadPicture("C:\\Program Files\\Spread70\\Samples\\Files\\card.jpg",1));
m_Spread.SetTypePictPicture((IDispatch *)picture.m_lpDispatch);
}
void COCXpropertiesDlg::OnClickFpbtn1()
{
CPicture picture;
m_Spread.SetCol(1);
m_Spread.SetRow(1);
// Get picture from cell
picture = m_Spread.GetTypePictPicture();
// Save picture to file
m_Spread.SavePicture((IDispatch *)picture.m_lpDispatch,"C:\\card.jpg",1);
}
Visual Basic
Private Sub Form_Load()
' Create a picture cell type
fpSpread1.Sheet = 1
fpSpread1.Col = 1
fpSpread1.Row = 1
fpSpread1.CellType = CellTypePicture
' Load the picture
' Change the path to match the correct directory
fpSpread1.TypePictPicture = fpSpread1.LoadPicture("C:\Program Files\Spread70\Samples\ActiveX\VB6\Demo Overview\images\texture1.bmp", PictureTypeBMP)
End Sub
Private Sub Command1_Click()
fpSpread1.Sheet = 1
fpSpread1.Col = 1
fpSpread1.Row = 1
' Save picture from cell to file
fpSpread1.SavePicture fpSpread1.TypePictPicture, "c:\test.jpg", PictureTypeJPEG
End Sub