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

    <p>Hi,</p><p>I got this "System.ApplicationException: Error saving Excel file' was thrown."  when i try to save my data to excel file. <br></p><p>Please use below code snippet for testing </p><p>------------------------------------------------------------ </p><p>   public void LoadDataSet()</p><p>        {</p><p>            DataSet dsApp = new DataSet("Beam");</p><p>            DataTable dtApp = new DataTable("Beams");</p><p>            
    dtApp .Columns.Add(new DataColumn("A", typeof(string)));</p><p>            
    dtApp .Columns.Add(new DataColumn("B", typeof(string)));</p><p>            
    dtApp .Columns.Add(new DataColumn("C", typeof(string)));</p><p>            
    dtApp .Columns.Add(new DataColumn("D", typeof(string)));</p><p>            
    dtApp .Columns.Add(new DataColumn("E", typeof(string)));</p><p>            
    dtApp .Columns.Add(new DataColumn("F", typeof(string)));</p><p>            
    dtApp .Columns.Add(new DataColumn("G", typeof(string)));</p><p>            
    dtApp .Columns.Add(new DataColumn("H", typeof(string)));</p><p>            
    dtApp .Columns.Add(new DataColumn("I", typeof(string)));</p><p>            
    dtApp .Columns.Add(new DataColumn("J", typeof(string)));</p><p>            
    dtApp .Columns.Add(new DataColumn("K", typeof(string)));</p><p>            
    dtApp .Columns.Add(new DataColumn("L", typeof(string)));</p><p>             dtApp .Columns.Add(new DataColumn("M", typeof(string)));</p><p>            
    dtApp  .Columns.Add(new DataColumn("N", typeof(string)));</p><p>            
    dtApp  .Columns.Add(new DataColumn("O", typeof(string)));</p><p>            
    dsApp .Tables.Add(
    dtApp   );</p><p>            for (int i = 0; i < 154000; i++)</p><p>            {</p><p>                
    dtApp .Rows.Add(new object[]{"a","a","a","a","a","a","a","a","a","a","a","a","a","a","a"});</p><p>            }</p><p>            SheetView sView = new SheetView("aa");</p><p>            sView.RowCount = 
    154000 ;</p><p>            sView.ColumnCount = 15;</p><p>            sView.DataSource =   dsApp  ;</p><p>            string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "formula1.xls");</p><p>            FpSpread spread = new FpSpread();</p><p>            spread.Sheets.Add(sView);</p><p>            spread.SaveExcel(System.IO.Path.ChangeExtension(path, ".xlsx"), FarPoint.Excel.ExcelSaveFlags.UseOOXMLFormat);</p><p>        }</p><p> </p><p> </p><span style="font-family:Verdana, Helvetica, Arial, sans-serif;font-size:14px;">************** Exception Text **************</span><br style="font-family:Verdana, Helvetica, Arial, sans-serif;font-size:14px;"><span style="font-family:Verdana, Helvetica, Arial, sans-serif;font-size:14px;">System.ApplicationException: Error saving Excel file ---> System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.</span><br style="font-family:Verdana, Helvetica, Arial, sans-serif;font-size:14px;"><span style="font-family:Verdana, Helvetica, Arial, sans-serif;font-size:14px;">  at dw.a(ZipOutputStream A_0, Crc32 A_1, String A_2, Stream A_3)</span><br style="font-family:Verdana, Helvetica, Arial, sans-serif;font-size:14px;"><span style="font-family:Verdana, Helvetica, Arial, sans-serif;font-size:14px;">  at dw.a(a A_0, Stream A_1)</span><br style="font-family:Verdana, Helvetica, Arial, sans-serif;font-size:14px;"><span style="font-family:Verdana, Helvetica, Arial, sans-serif;font-size:14px;">  at fg.a(IExcelWrite A_0, String A_1, Stream A_2, ExcelSaveFlags A_3)</span><br style="font-family:Verdana, Helvetica, Arial, sans-serif;font-size:14px;"><span style="font-family:Verdana, Helvetica, Arial, sans-serif;font-size:14px;">  at FarPoint.Excel.ExcelFileHandler.b(String A_0, ExcelSaveFlags A_1)</span><br style="font-family:Verdana, Helvetica, Arial, sans-serif;font-size:14px;"><span style="font-family:Verdana, Helvetica, Arial, sans-serif;font-size:14px;">  at FarPoint.Excel.ExcelFileHandler.Save(String fileName, ExcelSaveFlags saveFlags, String password)</span><br style="font-family:Verdana, Helvetica, Arial, sans-serif;font-size:14px;"><span style="font-family:Verdana, Helvetica, Arial, sans-serif;font-size:14px;">  at ci.a(String A_0, ExcelSaveFlags A_1, String A_2)</span><br style="font-family:Verdana, Helvetica, Arial, sans-serif;font-size:14px;"><span style="font-family:Verdana, Helvetica, Arial, sans-serif;font-size:14px;">  at c9.a(String A_0, Stream A_1, ExcelSaveFlags A_2, ExcelWarningList A_3, String A_4)</span><br style="font-family:Verdana, Helvetica, Arial, sans-serif;font-size:14px;"><span style="font-family:Verdana, Helvetica, Arial, sans-serif;font-size:14px;">  --- End of inner exception stack trace ---</span><br style="font-family:Verdana, Helvetica, Arial, sans-serif;font-size:14px;"><span style="font-family:Verdana, Helvetica, Arial, sans-serif;font-size:14px;">  at c9.a(String A_0, Stream A_1, ExcelSaveFlags A_2, ExcelWarningList A_3, String A_4)</span><br style="font-family:Verdana, Helvetica, Arial, sans-serif;font-size:14px;"><span style="font-family:Verdana, Helvetica, Arial, sans-serif;font-size:14px;">  at FarPoint.Win.Spread.FpSpread.SaveExcel(String fileName, ExcelSaveFlags saveFlags, ExcelWarningList warningList, String password)</span><br style="font-family:Verdana, Helvetica, Arial, sans-serif;font-size:14px;"><span style="font-family:Verdana, Helvetica, Arial, sans-serif;font-size:14px;">  at FarPoint.Win.Spread.FpSpread.SaveExcel(String fileName, ExcelSaveFlags saveFlags, String password)</span><br style="font-family:Verdana, Helvetica, Arial, sans-serif;font-size:14px;"><p><span style="font-family:Verdana, Helvetica, Arial, sans-serif;font-size:14px;">  at FarPoint.Win.Spread.FpSpread.SaveExcel(String fileName, ExcelSaveFlags saveFlags)</span> </p>
  • Replied 8 September 2017, 2:57 pm EST

    <p>Hello,</p><p>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:</p><p>                        http://www.gcpowertools.com/DownloadLatestVersion<br></p><p>Hope it will help you. Please let me know if you have any queries further.</p><p>Thanks,</p><p>Manpreet Kaur <br></p><p> </p>
  • Replied 8 September 2017, 2:57 pm EST

    <p>Hi 
    <span style="font-family:Tahoma, Arial, Helvetica;text-align:left;">Manpreet Kaur,</span></p><p><span style="font-family:Tahoma, Arial, Helvetica;text-align:left;"></span>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.</p><p>Thank you. </p>
  • Replied 8 September 2017, 2:57 pm EST

    <p>Hello,</p><p>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:</p><p>                                                       http://www.gcpowertools.com/DownloadLatestVersion<br></p><p> Please let me know your observations further on this issue.</p><p>Thanks,</p><p>Manpreet Kaur <br></p>
Need extra support?

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

Learn More

Forum Channels