コード例 #1
0
        public Tuple <Stream, string, string> CreateExcel()
        {
            var addrUrl = NPOIExcelHelper.ExportTest();

            string fileExt = Path.GetExtension(addrUrl);

            //获取文件的ContentType
            var provider    = new FileExtensionContentTypeProvider();
            var contentType = provider.Mappings[fileExt];

            addrUrl = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, addrUrl);

            var stream = new FileStream(addrUrl, FileMode.Open);

            return(new Tuple <Stream, string, string>(stream, Path.GetFileName(addrUrl), contentType));
        }