Error Saving Excel file - No open entry

Posted by: aspnetdev on 8 September 2017, 6:17 am EST

  • Posted 8 September 2017, 6:17 am EST

    We use Farpoint spread (version 7.35.20132.1) for our windows application. One of the feature we have uses fpSpread.SaveExcel function in following way.

    [csharp]

    using (MemoryStream strm = new MemoryStream())

    {

    sheets.SaveExcel(strm, FarPoint.Excel.ExcelSaveFlags.UseOOXMLFormat);

    }[/csharp]

    Few of our users started getting following error from SaveExcel method intermittently.

    Inner Exception

    ---------------

    Type : System.InvalidOperationException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

    Message : No open entry

    Source : FarPoint.Excel

    Help link :

    Data : System.Collections.ListDictionaryInternal

    TargetSite : Void CloseEntry()

    Stack Trace : at ICSharpCode.SharpZipLib.Zip.ZipOutputStream.CloseEntry()

    at fg.a(IExcelWrite A_0, String A_1, Stream A_2, ExcelSaveFlags A_3)

    at FarPoint.Excel.ExcelFileHandler.b(Stream A_0, ExcelSaveFlags A_1)

    at FarPoint.Excel.ExcelFileHandler.Save(Stream stream, ExcelSaveFlags saveFlags, String password)

    at ci.a(Stream A_0, ExcelSaveFlags A_1, String A_2)

    at c9.a(String A_0, Stream A_1, ExcelSaveFlags A_2, ExcelWarningList A_3, String A_4)

    So far we have not been able to replicate this issue on any Developer machines.

    Can you please help us understand what could be the reasons of this failure ? Under what circumstances Farpoint code can fail with this exception ?

    Thank you.

  • Posted 8 September 2017, 6:17 am EST

    Code lines went missing from my original post. Here is how we call SaveExcel method.

    using (MemoryStream strm = new MemoryStream())

    {

    sheets.SaveExcel(strm, FarPoint.Excel.ExcelSaveFlags.UseOOXMLFormat);

    }

  • Posted 8 September 2017, 6:17 am EST

    Hello,

    It could be dependent on size of SpreadSheet data. Hence, could you save your spreadsheet to XML (using the Save function)? Then zip and send that file for us to debug the issue at our end.

    However, in the meantime please go through this link which explains some information on inner exception:-

    https://msdn.microsoft.com/en-us/library/system.exception.innerexception(v=vs.110).aspx

    And also, I suggest trying different overloads which use Stream, and see whether you get an exception creating the FileStream to pass to OpenExcel.

    Please share your observations on the same. We will look into this issue further.

    Thanks,

    Reeva

  • Posted 8 September 2017, 6:17 am EST

    Thanks for your response.

    The InnerException I pasted in my original post is associated with main exception. I did not include full exception message because it was not relevant for this topic.

    We just want to know under what situations FarPoint.Win.Spread.FpSpread.SaveExcel method can fail with “No open entry” exception. May be our Spread object does not have correct sheets or has bad values in it ?

    So far only a few users get this error intermittently and we cannot reproduce this error on developer machines at all even if we try the exact same case.

    So we were hoping that you could provide us more insights on SaveExcel method. We can then at least look into some specific direction and determine if our code has any issues in setting sheets value or any other issues of that nature.

    Thanks!

  • Posted 8 September 2017, 6:17 am EST

    Hello,

    It could be a permission issue; do you have write access to the folder path where you save the file on the server?

    And as you said its an intermittent issue. Hence, we need sample application replicating the issue so that we can investigate this further and come to some conclusion.

    Thanks,

    Reeva

  • Posted 24 November 2021, 11:36 pm EST

    Hello

    I had this problmen if i loaded spread and the System.Globalization.CultureInfo.CurrentCulture was like “en-SE”,

    Then the spread was empty and the sheets.SaveExcel(strm, FarPoint.Excel.ExcelSaveFlags.UseOOXMLFormat); throws “no open entry”.

    I investigated this it seams like some cultures like “en-SE”

    Have:

    ANSICodePage: 0

    LCID: 8192.

    Not supported ?

    So for me the solution is to use a “valid” culture as close to the one current user is using when parsing.

    Meaning i just:

    
     var currentCulture = System.Globalization.CultureInfo.CurrentCulture;
    try
    {
    if (System.Globalization.CultureInfo.CurrentCulture.TextInfo.ANSICodePage == 0)
    {
    
    	System.Globalization.CultureInfo.CurrentCulture = new System.Globalization.CultureInfo("sv-SE");
    	System.Globalization.CultureInfo.CurrentCulture.NumberFormat = currentCulture.NumberFormat;
    	System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat = currentCulture.DateTimeFormat;
    }
     Load and save..
    }finally
    {
     System.Globalization.CultureInfo.CurrentCulture = currentCulture;
    }
    
    

    Br

    Mikael

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels