Spire.XLS for .NET is a professional Excel .NET library that can be used to any type of .NET( C#, VB.NET, ASP.NET, .NET Core) application, both ASP.NET web sites and Windows Forms application.

Wed Feb 20, 2013 5:08 pm

Hello

I am migrating to generate reports in a web-service and am having a strange problem that occurs sometimes, other times not, file is ok.

Apparently the Spire.XLS is keeping the file in use after closing, and the result is a corrupted file.

20 times reapeting same operation, at least about 5 this kind of problem occurs.

I'm using version 5.8.5.4.

I tried to migrate to the latest version which I am entitled, but there was another problem with special characters, as well as the problem of file in use also occurred.

What can I do?

condornwmsn
 
Posts: 4
Joined: Tue Sep 13, 2011 9:53 pm

Thu Feb 21, 2013 7:15 am

Hello,

Thanks for your inquiry.
Please try the solution below to load your excel document.
Code: Select all
              using (Workbook workbook = new Workbook())
                    {
                        byte[] bytes = File.ReadAllBytes(excelfilePath);
                        using (Stream stream = new MemoryStream(bytes))
                        {
                            workbook.LoadFromStream(stream);
                        }
                    }
 


Please tell us if you still have the problem after try the code above.

Best Regards,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2328
Joined: Wed Jun 27, 2012 8:50 am

Return to Spire.XLS

cron