Xbasic
Office::ExcelDocumentAddPicture Method
Syntax
.AddPicture as N (File as B)
.AddPicture as N (File as C)
Arguments
- FileBinary Character
The fully qualified image file name or binary image data to add to the spreadsheet.
Returns
- resultNumeric
Returns the picture's index. Used with the Office::Spreadsheet SetPicture() method to add the picture to the spreadsheet.
Description
Add a new picture to the document from the file specified. Formats supported include BMP, DIB, PNG, JPG and WMF Use the index value returned to reference the picture in other functions such as Office::Spreadsheet::SetPicture().
Example
dim Doc as Office::ExcelDocument dim picfile as C = "Daffodils.jpg" dim Id as N // Add picture to document Id = Doc.AddPicture(picfile) // Add picture to cell in Sheet Sheet = Doc.AddSheet("Picture") Sheet.SetPicture(1,1,Id) // Adding a picture from a blob dim picBlob as B dim filename as C = "Daisies.jpg" picBlob = File.To_Blob(filename) // Add picture to document Id = Doc.AddPicture(picBlob) // Add picture to cell in Sheet Sheet.SetPicture(1,2,Id)
See Also