awalker89 / openxlsx

R package for .xlsx file reading and writing.
Other
363 stars 79 forks source link

Delete media from workbook #548

Open drk-1 opened 1 year ago

drk-1 commented 1 year ago

I would like to delete an image from a workbook. wb@.xData$media[1]

image1.png "C:/Users/DIEGO4~1/AppData/Local/Temp/RtmpKaTqyv/file50f81e22763a/xl/media/image1.png"

How can I go about it? If I just: wb@.xData$media[1] <- NA

I get

Error in file.copy(x, file.path(xlmediaDir, names(media)[which(media == : no files to copy to

when trying to save.

If wb@.xData$media[1] <- "" Then I can save but when opening the excel file it has to be repaired

Removed Part: /xl/drawings/vmlDrawing1.vml part. (Drawing shape)

Thanks!

sessionInfo()

drk-1 commented 1 year ago

I made it work by running:

wb@.xData$vml[1] <- ""