Esempio n. 1
0
 /// <summary>
 /// Closes the package.
 /// </summary>
 public void Dispose()
 {
     if (_package != null)
     {
         if (_isExternalStream == false && _stream != null && (_stream.CanRead || _stream.CanWrite))
         {
             _stream.Close();
         }
         CloseStream();
         _package.Close();
         if (_isExternalStream == false)
         {
             ((IDisposable)_stream).Dispose();
         }
         if (_workbook != null)
         {
             _workbook.Dispose();
         }
         _package  = null;
         _images   = null;
         _file     = null;
         _workbook = null;
         _stream   = null;
         _workbook = null;
         GC.Collect();
     }
 }
Esempio n. 2
0
 private void Close()
 {
     application.Dispose();
     workBook.Dispose();
     //System.Runtime.InteropServices.Marshal.ReleaseComObject(application);
     application = null;
     workBook    = null;
     workSheet   = null;
     //System.GC.Collect();
 }
Esempio n. 3
0
 /// <summary>
 /// Closes the package.
 /// </summary>
 public void Dispose()
 {
     if (_package != null)
     {
         if (_isExternalStream == false && _stream != null && (_stream.CanRead || _stream.CanWrite))
         {
             CloseStream();
         }
         _package.Close();
         if (_workbook != null)
         {
             _workbook.Dispose();
         }
         _package  = null;
         File      = null;
         _workbook = null;
         _stream   = null;
         _workbook = null;
         GC.Collect();
     }
 }
 /// <summary>
 /// Closes the package.
 /// </summary>
 public void Dispose()
 {
     if (_package != null)
     {
         if (Stream != null && (Stream.CanRead || Stream.CanWrite))
         {
             Stream.Close();
         }
         _package.Close();
         ((IDisposable)_stream).Dispose();
         if (_workbook != null)
         {
             _workbook.Dispose();
         }
         _package  = null;
         _images   = null;
         _file     = null;
         _workbook = null;
         _stream   = null;
         _workbook = null;
     }
 }