/// <summary>
		/// Creates SeekErrorMemoryStream copy data from the source
		/// </summary>
		/// <param name="source"></param>
		public static SeekErrorMemoryStream CreateFromStream(Stream source)
		{
			var forwardStream = new SeekErrorMemoryStream();
			forwardStream.canSeek = true;

			Helper.CopyStream(source, forwardStream);
			forwardStream.Seek(0, SeekOrigin.Begin);
			
			//now disable seek
			forwardStream.canSeek = false;

			return forwardStream;
		}
Exemple #2
0
        /// <summary>
        /// Creates SeekErrorMemoryStream copy data from the source
        /// </summary>
        /// <param name="source"></param>
        public static SeekErrorMemoryStream CreateFromStream(Stream source)
        {
            var forwardStream = new SeekErrorMemoryStream();

            forwardStream.canSeek = true;

            Helper.CopyStream(source, forwardStream);
            forwardStream.Seek(0, SeekOrigin.Begin);

            //now disable seek
            forwardStream.canSeek = false;

            return(forwardStream);
        }
        public void Issue_11639_11644_ForwardOnlyStream()
        {
            //Excel.Log.Log.InitializeWith<Log4NetLog>();
            var forwardStream = SeekErrorMemoryStream.CreateFromStream(Helper.GetTestWorkbook("Test_OpenOffice"));

            IExcelDataReader excelReader =
                ExcelReaderFactory.CreateBinaryReader(forwardStream);

            excelReader.IsFirstRowAsColumnNames = false;
            var dataset = excelReader.AsDataSet();


            excelReader.Close();
        }