close process generated with xlslo

Hi,


I have an application that uploads a file and saves it in a physical path after I read it to save the data but to the
want to upload another file with the same name tells me it is busy (.NET Core Host has the file open)

Is there any way to finish the process when I finish reading the file with XLSLO?


One more thing as I can put the rows in red according to a condition in the datagrid, can it be done?

I'm taking the following example, nadas that to have a .xlsx created I upload it with upload and then read it with XLSLO

https://aspnetcore.syncfusion.com/xlsio/clrobjects

Regards!

1 Reply

PK Prakash Kumar D Syncfusion Team October 4, 2018 09:09 AM UTC

Hi Corazon, 
 
Thank you for contacting Syncfusion support. Please find the details below 
 
Issue  
Details 
I have an application that uploads a file and saves it in a physical path after I read it to save the data but to the 
want to upload another file with the same name tells me it is busy (.NET Core Host has the file open) 
 
Is there any way to finish the process when I finish reading the file with XLSLO? 
 
We suspect that this issue might be raised due to while importing the Excel document, the file stream is created and not closed after the document is manipulated. Because of the stream still in process, you cannot upload the file with same name. 
 
Please refer the code snippet below. 
 
Code snippet: 
//Step 1 : Instantiate the spreadsheet creation engine. 
ExcelEngine excelEngine = new ExcelEngine(); 
//Step 2 : Instantiate the excel application object. 
IApplication application = excelEngine.Excel; 
FileStream inputStream = new FileStream(basePath + @"\"+ uploadedFileName, FileMode.Open, FileAccess.Read); 
IWorkbook workbook = application.Workbooks.Open(inputStream); 
IWorksheet sheet = workbook.Worksheets[0]; 
//Export Bussiness Objects 
List<Sales> CLRObjects = sheet.ExportData<Sales>(1, 1, 41, 4); 
//Close the workbook. 
inputStream.Close(); 
workbook.Close(); 
excelEngine.Dispose(); 
 
One more thing as I can put the rows in red according to a condition in the datagrid, can it be done? 
We have prepared sample to achieve your requirement which can be downloaded from the following link. 
 
 
 
 
Regards, 
Prakash Kumar 


Loader.
Up arrow icon