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

Page crash and with error message"Can not find the file" when I use the Save() function

I us version 8.2,when export the excel which has 2 sheets,then page crashed,but in version 6.1 it is correct
Stack trace:
at Syncfusion.XlsIO.Implementation.Collections.RowStorage.FillStream(BinaryWriter writer, DataProvider provider, IEncryptor encryptor, Int32 streamPosition)
at Syncfusion.XlsIO.Parser.BiffWriter.WriteRecord(OffsetArrayList records, IEncryptor encryptor)
at Syncfusion.XlsIO.Implementation.WorkbookImpl.WorkbookExcel97Serializator.SaveToStgStream(ICompoundStorage storage, Boolean bDisposeAfterSave, OffsetArrayList records, IEncryptor encryptor, WorkbookImpl book)
at Syncfusion.XlsIO.Implementation.WorkbookImpl.WorkbookExcel97Serializator.Serialize(String fullName, WorkbookImpl book, ExcelSaveType saveType)
at Syncfusion.XlsIO.Implementation.WorkbookImpl.SaveAs(String FileName, ExcelSaveType saveType, ExcelVersion version)
at Syncfusion.XlsIO.Implementation.WorkbookImpl.SaveAs(String FileName)

"Object reference not set to an instance of an object."

In version 6.1 it is correct



7 Replies

SB Sathish Babu R Syncfusion Team October 14, 2010 01:11 PM UTC

Hi bill,

Thank you for your interest in Syncfusion products.

We have analyzed the exception details which you have posted in the last post and we were not able find the actual cause of this issue. So it’s not possible to fix this issue without the actual input excel files. Please could you share us the input template which reproduces the issue. This will be helpful for us to further investigate this issue.

Could you please let us know if you have any queries.

Regards,
Sathish




SC Srivatsan Chellam November 17, 2010 01:06 PM UTC

We are experiencing a similar issue. We updated from 6.4 to 8.2 and when we try to export a grouping grid to excel we get the same error and stack trace.



LR Lokesh R Syncfusion Team November 19, 2010 01:01 PM UTC

Hi Bill,

We regret for the inconvenience.

As we have updated earlier, Can you please update us the simple issue reproducing sample. So that we can analyze the actual cause of the issue and help you out on the same.

Please let us know if you need any clarifications.

Thanks,
Lokesh.




JB Joel Brewster February 16, 2012 04:21 PM UTC

Is there any sort of update that includes the resolution to this issue? I am also experiencing this exact issue even with the 10.1 release so we would be interested in any help that can be provided.



SR Sridhar Syncfusion Team February 17, 2012 05:09 AM UTC

Hi Joel,

Thank you for the update.

We have analysed further for the above reported stack trace and we came across the following solutions.

1.When using the IWorkbook object as global and ExcelEngine object used with in a method there is a chance for the above reported error.

Please make use of the ExcelEngine object as global where the IWorkbook is derived from the ExcelEngine.

2.Using the static method which instantiates the ExcelEngine and IApplication objects and it return the workbook object from another class file also throws the above error.

Please use the ExcelEngine and IApplication objects in the main class (Ex.,Aspx Page) and use it.


Please try the above secnarios at your side and let us know if this helps you. If you still face the issue, please get back to us with the simplified sample which reproduces the issue to proceed further on this.

Please let me know if you require any further clarifications.

Thanks,
Sridhar.S



JB Joel Brewster February 17, 2012 03:51 PM UTC

Sridhar,

Thanks for this info, it provided some good insight on a different approach. I changed the instantiation of the ExcelEngine to use a singleton pattern and it seems to have cleared up the error.

Here is a sample snippet on the solution:

private static ExcelEngine _excelEngine;

///
/// Singleton instance of ExcelEngine
///

protected static ExcelEngine ExcelEngine
{
get
{
if (_excelEngine == null)
_excelEngine = new ExcelEngine();

return _excelEngine;
}
}

Changed to use the singleton property of ExcelEngine when creating an instance of IApplication:

///
/// outputs the results of the query to the stream as an excel spreadsheet
///

///
///
public Byte[] SaveSRExportAsExcel(SearchCriteria criteria)
{
IApplication application = ExcelEngine.Excel;

IWorkbook workbook = application.Workbooks.Create(1);

Seems to clear up the problem. I will update you if we still see any issues with this approach.




SR Sridhar Syncfusion Team February 20, 2012 06:01 AM UTC

Hi Joel,

Thank you for the update.

We are glad to know the above reported issue has been resolved.

Please let us know if you require any further clarifications and we are happy to help you out.

Thanks,
Sridhar.S


Loader.
Live Chat Icon For mobile
Up arrow icon