Skip to main content

Delete-Image

Command Description

Spelected images in delete worksheet If the image is passed to a number, the positioning image is calculated according to the insertion order; if it is incoming a string, according to image name

Command Prototype

Excel.DeleteImage(objExcelWorkBook,sheet,objPic)

Parameter Description

ParameterRequiredTypeDefaultDescription
objExcelWorkBookTrueexpressionobjExcelWorkBookExcel workbook object (workbook opened with "Open Excel" command (Excel.OpenExcel) or the workbook object returned by the command "Bind Excel" (Excel.BindBook))
sheetTruestring"Sheet1"The string means sheet name. The number means sheet order(starting from 0)
objPicTruestring""The sequence (starting from 0) or name of the image to be deleted

Demo

/************************Delete picture************************ ******** 
**Input 1:
** objExcelWorkBook -- Excel workbook object (a workbook opened using the "Open Excel" command (Excel.OpenExcel) or a work bound using the "Bind Excel" command (Excel.BindBook) book object).
**Entry 2:
** sheet--If a string is used, it means the name of the specified worksheet; if a number is used, it means the order of the specified worksheet (starting from 0).
**Entry 3:
** objPic--The order or name of the pictures to be deleted, the order starts from 0.
**
*********************************************************************/
// The running result of this command will be offset with the running result of inserting the picture, so comment, the code is as follows
objExcelWorkBook = Excel.OpenExcel(@res"Test.xlsx",true)
Excel.DeleteImage(objExcelWorkBook,"Sheet1","示例")
TracePrint "The picture named 'Example' has been deleted from the Excel object Sheet1 sheet"
Excel.CloseExcel(objExcelWorkBook,true)