Quantcast
Channel: NPOI
Viewing all articles
Browse latest Browse all 1621

Created Unassigned: XSSFWorkbook Cannot access a closed MemoryStream [13664]

$
0
0
Recently, I had downloaded NOPI 2.1.X and tried to export Excel 2007 file(.xlsx), but I always got exception from the code, it can not to write to MemeoryStream, and the Exception to be " System.ObjectDisposedException".

////////////////////////////////////////////

using NPOI.SS.UserModel;
using NPOI.XSSF;
using NPOI.XSSF.UserModel;


IWorkbook workbook = new XSSFWorkbook();

XSSFSheet worksheet = (XSSFSheet)workbook.CreateSheet("Sheet A_20");
....
....

MemoryStream MS = new MemoryStream();

workbook.Write(MS); // ((System.IO.Stream)(MS)).Length' threw an exception of type 'System.ObjectDisposedException'", Cannot access a closed Stream.

workbook = null;

MS.Close();
MS.Dispose();

Does anyone has ideas?

Viewing all articles
Browse latest Browse all 1621

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>