09-20-2022 03:30 AM
I am unable to delete image from excel using the code.
Deleting using rows is not deleting the image.
Please help.
Thank you
09-20-2022 04:02 AM - edited 09-20-2022 04:04 AM
Hi, please save the VI for older versions of LV (e.g. 20) so that everyone can access the file. Go to File --> Save for previous versions and upload it once again.
Thanks,
Fort
09-20-2022 04:13 AM
2016 Version
09-20-2022 04:14 AM
2016 version
09-20-2022 04:43 AM - edited 09-20-2022 04:48 AM
If the image is not included in any specific cell, it won't be deleted when deleting rows. Could you upload an excel file sample or a screenshot to show exactly what you are trying to achieve?
09-20-2022 05:38 AM
I added the image this way.
I want to delete the same once a pdf report is generated.
So the excel is empty for new data.
09-22-2022 02:44 PM - edited 09-22-2022 02:48 PM
Vidya, take a look at this section of the code that you use to delete the contents in the excel file:
As you already know, this is selecting a range of cells in the worksheet, and then deletes. First let's understand why it is not deleting the image:
In Excel, if you select a range of cells and press 'Delete', it is only deleting the contents in those cells.
It will only delete objects if you manually click on them and press 'Delete'.
Since your "adding image to Excel" code is only adding the image at a certain coordinates and not inside the cell, it will not be deleted with your code.
Thus, you'll exclusively be able to delete objects via LV if you find a way to select objects programmatically. Now, after a bit of research, I have not been able to find any property/invoke node to do that; but I am optimistic that you, or someone else, will.
Nonetheless, I am offering you a cheeky workaround so that you can get something running (hopefully!):
This VI creates a new empty worksheet and deletes the one you have been working with (considering you only have one). Therefore, it is like deleting the contents of the one you already had.
Try it out and reach out as needed,
Fort
09-22-2022 03:02 PM
Can you save an empty excel as template for new data instead of deleting images at runtime?
09-23-2022 02:22 AM
can't use xltx?