Error saving Excel file in Windows7 32bit machine

Posted by: stevenlee-fp on 8 September 2017, 2:57 pm EST

  • Posted 8 September 2017, 2:57 pm EST

    Hi,

    I got this "System.ApplicationException: Error saving Excel file' was thrown."  when i try to save my data to excel file. 

    Please use below code snippet for testing 

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

       public void LoadDataSet()

            {

                DataSet dsApp = new DataSet("Beam");

                DataTable dtApp = new DataTable("Beams");

                
    dtApp .Columns.Add(new DataColumn("A", typeof(string)));

                
    dtApp .Columns.Add(new DataColumn("B", typeof(string)));

                
    dtApp .Columns.Add(new DataColumn("C", typeof(string)));

                
    dtApp .Columns.Add(new DataColumn("D", typeof(string)));

                
    dtApp .Columns.Add(new DataColumn("E", typeof(string)));

                
    dtApp .Columns.Add(new DataColumn("F", typeof(string)));

                
    dtApp .Columns.Add(new DataColumn("G", typeof(string)));

                
    dtApp .Columns.Add(new DataColumn("H", typeof(string)));

                
    dtApp .Columns.Add(new DataColumn("I", typeof(string)));

                
    dtApp .Columns.Add(new DataColumn("J", typeof(string)));

                
    dtApp .Columns.Add(new DataColumn("K", typeof(string)));

                
    dtApp .Columns.Add(new DataColumn("L", typeof(string)));

                 dtApp .Columns.Add(new DataColumn("M", typeof(string)));

                
    dtApp  .Columns.Add(new DataColumn("N", typeof(string)));

                
    dtApp  .Columns.Add(new DataColumn("O", typeof(string)));

                
    dsApp .Tables.Add(
    dtApp   );

                for (int i = 0; i < 154000; i++)

                {

                    
    dtApp .Rows.Add(new object[]{"a","a","a","a","a","a","a","a","a","a","a","a","a","a","a"});

                }

                SheetView sView = new SheetView("aa");

                sView.RowCount = 
    154000 ;

                sView.ColumnCount = 15;

                sView.DataSource =   dsApp  ;

                string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "formula1.xls");

                FpSpread spread = new FpSpread();

                spread.Sheets.Add(sView);

                spread.SaveExcel(System.IO.Path.ChangeExtension(path, ".xlsx"), FarPoint.Excel.ExcelSaveFlags.UseOOXMLFormat);

            }

     

     

    ************** Exception Text **************
    System.ApplicationException: Error saving Excel file ---> System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
      at dw.a(ZipOutputStream A_0, Crc32 A_1, String A_2, Stream A_3)
      at dw.a(a A_0, Stream A_1)
      at fg.a(IExcelWrite A_0, String A_1, Stream A_2, ExcelSaveFlags A_3)
      at FarPoint.Excel.ExcelFileHandler.b(String A_0, ExcelSaveFlags A_1)
      at FarPoint.Excel.ExcelFileHandler.Save(String fileName, ExcelSaveFlags saveFlags, String password)
      at ci.a(String 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)
      --- End of inner exception stack trace ---
      at c9.a(String A_0, Stream A_1, ExcelSaveFlags A_2, ExcelWarningList A_3, String A_4)
      at FarPoint.Win.Spread.FpSpread.SaveExcel(String fileName, ExcelSaveFlags saveFlags, ExcelWarningList warningList, String password)
      at FarPoint.Win.Spread.FpSpread.SaveExcel(String fileName, ExcelSaveFlags saveFlags, String password)

      at FarPoint.Win.Spread.FpSpread.SaveExcel(String fileName, ExcelSaveFlags saveFlags) 

  • Replied 8 September 2017, 2:57 pm EST

    Hello,

    I tested the issue at my end using the latest version of Spread i.e. Spread.Net 6 v6.0.xx05 and I was not able to replicate the issue at my end. I would suggest you to test the issue with this version of Spread to see if it resolves the issue that you are currently facing. You can downloadthe latest version of Spread i.e. Spread.Net 6 from the following link:

                            http://www.gcpowertools.com/DownloadLatestVersion

    Hope it will help you. Please let me know if you have any queries further.

    Thanks,

    Manpreet Kaur

     

  • Replied 8 September 2017, 2:57 pm EST

    Hi 
    Manpreet Kaur,

    The program has no problem when running in a 64-bit windows machine. Please try to replicate this issue using a 32-bit machine(either Vista or Windows7). I am sure you will get the same problem i am facing right now.

    Thank you. 

  • Replied 8 September 2017, 2:57 pm EST

    Hello,

    I tested the issue on Windows7, 32 bit machine and the latest version of Spread.Net 6 v 6.0.xx05 and I was not able to replicate the issue at my end. The file was saved without any issues, however on further investigation I found that I was not able to open the file in Excel. However, I was able to save and open the file in Excel in case I do not change the extension from .xls to .xlsx using the ChangeExtension method and initially provide the .xlsx extension. I would request you to test the issue with the latest version of Spread.Net 6 i.e. v6.0.xx05 which you can download from the following link:

                                                           http://www.gcpowertools.com/DownloadLatestVersion

     Please let me know your observations further on this issue.

    Thanks,

    Manpreet Kaur

Need extra support?

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

Learn More

Forum Channels