Free Support Forum - aspose.com

Unable to delete css files

Hi Team,

I am creating HTML from xlsx file.
I am sucessfully able to create one subfolder containg stylesheet.css file and individual html files per sheet in it and one final html file.

afterwards I want to delete subfolder and final html file from my local pc.

but I am getting error …
“ExceptionMessage”: “The process cannot access the file ‘stylesheet.css’ because it is being used by another process.”,

though all files are closed.

how to overcome this

@kotharib2,

Thanks for your query.

Well, you only need to delete the final HTML file and the files in the sub folder will be deleted automatically.

Hope, this helps a bit.

@kotharib2,

By the way, I tried the following sample code with a template XLSX file, it works fine and the relevant sub-folder (containing the resource files) with the main HTML file are successfully removed:
e.g
Sample code:

            string filePath = "e:\\test2\\";
            Workbook wb = new Workbook(filePath + "a.xlsx");
            wb.Save(filePath + "out1.html");
            Directory.Delete(filePath + "out1_files", true);
            File.Delete(filePath + "out1.html");

Hi @Ajmad_Sahi

Even I am using the same sample code to delete files and directories.

But I am getting error at the time of deleting “out1_files”, that stylesheet.css cant be delted because it is in use

@kotharib2,

This is strange, we could not find the issue on our end. Your issue does not have any links with Aspose.Cells APIs. You may try the sample code in a console application on some different machines or restart your system to re-execute the code segment.

I am getting error as stylesheet.css is open in IIS Explorer.

@kotharib2,

The issue does not seems to be related to Aspose.Cells APIs. You may browse internet to evaluate and fix the issue, see some documents/threads for reference:


https://support.microsoft.com/en-ca/help/973094/error-0x80070020-when-you-try-to-start-a-web-site-in-iis-7-0

If you still think it is an issue with Aspose.Cells, kindly do create a sample project (runnable), you may zip the project (with its resource files) prior attaching here, we will check it soon.