Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

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: 2766
Joined: Wed Jun 27, 2012 8:50 am

Return to Spire.XLS