We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Can''t open any xlsx files

I'm using Trial 6.3.0.6 and I can't seem to open any xlsx files. I tried several different xlsx, including opening your sample Invoice.xls and saving it as a xlsx. When I try:
FileStream fs = File.OpenRead("c:\\invoice.xlsx");
IWorkbook wb = app.Workbooks.Open(fs);
I get:
System.Runtime.InteropServices.ExternalException was unhandled
Message="Can't open storage on LockBytes."
Source="Syncfusion.XlsIO.Base"
ErrorCode=-2147286960
StackTrace:
at Syncfusion.XlsIO.IO.Stream.StgStream..ctor(Stream stream, STGM flags)
at Syncfusion.XlsIO.IO.Stream.StgStream..ctor(Stream stream)
at Syncfusion.XlsIO.Implementation.WorkbookImpl.ParseExcel97Stream(Stream stream, ExcelParseOptions options)
at Syncfusion.XlsIO.Implementation.WorkbookImpl..ctor(IApplication application, Object parent, Stream stream, ExcelParseOptions options, ExcelVersion version)
at Syncfusion.XlsIO.Implementation.WorkbookImpl..ctor(IApplication application, Object parent, Stream stream, ExcelVersion version)
at Syncfusion.XlsIO.Implementation.ApplicationImpl.CreateWorkbook(Object parent, Stream stream, ExcelVersion version)
at Syncfusion.XlsIO.Implementation.Collections.WorkbooksCollection.Open(Stream stream)
at Test.TestExcel.Go() in C:\Tests\TestMatt\TestExcel.cs:line 24
at Test.Program.Main(String[] args) in C:\Tests\TestMatt\Program.cs:line 23
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

When I try:
IWorkbook wb = app.Workbooks.Open("c:\\invoice.xlsx");
I get:
System.Runtime.InteropServices.ExternalException was unhandled
Message="Cannot open storage. File Name is: c:\\invoice.xlsx"
Source="Syncfusion.XlsIO.Base"
ErrorCode=-2147286960
StackTrace:
at Syncfusion.XlsIO.IO.Stream.StgStream..ctor(String fileName, STGM flags)
at Syncfusion.XlsIO.Implementation.WorkbookImpl..ctor(IApplication application, Object parent, String strFileName, ExcelParseOptions options, Boolean bReadOnly, String password, ExcelVersion version)
at Syncfusion.XlsIO.Implementation.WorkbookImpl..ctor(IApplication application, Object parent, String strFileName, ExcelParseOptions options, ExcelVersion version)
at Syncfusion.XlsIO.Implementation.WorkbookImpl..ctor(IApplication application, Object parent, String FileName, ExcelVersion version)
at Syncfusion.XlsIO.Implementation.ApplicationImpl.CreateWorkbook(Object parent, String strTemplateFile, ExcelVersion version)
at Syncfusion.XlsIO.Implementation.Collections.WorkbooksCollection.Open(String filename)
at Test.TestExcel.Go() in C:\Tests\TestMatt\TestExcel.cs:line 21
at Test.Program.Main(String[] args) in C:\Tests\TestMatt\Program.cs:line 23
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

Opening xls files works just fine. I'm running XP 32bit with VS 2005. Let me know if you need any more info.


5 Replies

YG Yavanaarasi G Syncfusion Team May 28, 2008 09:38 AM UTC

Hi Matt,

Thank you for your interest in Syncfusion products.

I am able to reproduce the issue that you have mentioned. But this issue can be solved by adding the ExcelOpenType.Automatic property while opening the workbook.

Here is the code snippet:


[C#]
IApplication app = excelEngine.Excel;
FileStream fs = File.OpenRead("C:\\Invoice.xlsx");
IWorkbook wb = app.Workbooks.Open(fs, ExcelOpenType.Automatic);



Please try this and let me know if this helps.

Regards,
G.Yavana




MS Matt Smith May 28, 2008 04:58 PM UTC

That worked, thanks!



YG Yavanaarasi G Syncfusion Team May 29, 2008 10:12 AM UTC

Hi Matt,

Thank you for your update.

Glad to hear that the problem could be solved.

Please let me know if you have any other concerns.

Regards,
G.Yavana



PR Prakash July 29, 2008 09:35 AM UTC

Hi,
I am using the component, syncfusion.XlsIO. I have excel file which having 42 columns and 400 rows of data. While invoking the method, sheets.ExportDataTable() ... it takes more than 4 minutes to load the data into the data table.
Can u pls help me to improve the performance?

Regards
Prakash M

>Hi Matt,

Thank you for your update.

Glad to hear that the problem could be solved.

Please let me know if you have any other concerns.

Regards,
G.Yavana





YG Yavanaarasi G Syncfusion Team August 7, 2008 11:18 AM UTC

Hi Prakash,

Sorry for the delay in responding.

I am not able to reproduce the issue that you mentioned here. I have created a file with 42 columns, 400 rows and Export the DataTable. The time takes less than 1min.

Here is the sample for your reference:
http://www.syncfusion.com/development/uploads/ExportDatatable_96dd9215.zip

We have tested this issue in our latest version of Essential studio 2008 volume 3 [v6.3.0.30]. We have optimized the performance in the latest version. Could you please let me know the Essential studio version in which the issue caused?

Regards,
G.Yavana


Loader.
Live Chat Icon For mobile
Up arrow icon