Free Support Forum - aspose.com

Cells Save as xml not releasing image files

Hi.

I have an issue where I save a worksheet to pdf xml in a temp directory, bind a pdf to it, save the pdf then try to delete the temp directory. My problem is that a logo in the worksheet is saved as a separate image with the xml, then when I go to delete the temp directory it tells me the image is in use by another process.

Of course, it isn’t, so is the pdf save hanging on to it for too long? do I need to pdf.close of some such?

Heres a sample of my code:

’ save as xml
work.Save(tempdir & xmlfile, Aspose.Cells.FileFormatType.AsposePdf)
’ Open as PDF from XML
pdf.BindXML(tempdir & xmlfile, Nothing)
’ Write to Network share
pdf.Save(pdfDir & pdffile)
’ Cleanup
System.IO.Directory.Delete(tempdir, True)



Hi,

Could you simply remove the coding lines related Aspose.Pdf component APIs to check if it causes this issue.

E.g.,

' save as xml
work.Save(tempdir & xmlfile, Aspose.Cells.FileFormatType.AsposePdf)
' Cleanup
System.IO.Directory.Delete(tempdir, True)

Thank you.

When I remove the pdf code, the tempdir is cleaned out without error.

So, it is indeed, the pdf save that is not releasing the image file.

Thanks.

Will there be any progress on this issue soon?

Just to review, saving as XML then deleting works.

Saving the xml as a pdf then deleteing doesn’t work.

As you said, this is a Pdf product’s issue so I move your post to pdf forum. Our pdf team will support you soon.

Hi,

I have tested this with Aspose.Pdf v 3.6.1.10 and was not able to reproduce the error. Which version are you using.

Thanks.

I installed that version yesterday for a different issue.

But lo and behold, it works for the deletion now. Good O!

Thanks.