示例#1
0
 /// <summary>
 /// Default SaveAs Xlsx file
 /// </summary>
 public static void SaveAs(this Stream stream, object value, bool printHeader = true, string sheetName = null, ExcelType excelType = ExcelType.XLSX)
 {
     if (excelType == ExcelType.UNKNOWN)
     {
         throw new InvalidDataException("Please specify excelType");
     }
     ExcelFacorty.GetExcelProvider(excelType, printHeader, sheetName).SaveAs(stream, value);
 }
示例#2
0
        public static IEnumerable <dynamic> Query(this Stream stream, bool useHeaderRow = false, ExcelType excelType = ExcelType.UNKNOWN, IConfiguration configuration = null)
        {
            if (excelType == ExcelType.UNKNOWN)
            {
                excelType = GetExcelType(stream);
            }

            return(ExcelFacorty.GetExcelProvider(excelType, useHeaderRow).Query(stream, useHeaderRow));
        }
示例#3
0
        public static IEnumerable <T> Query <T>(this Stream stream, ExcelType excelType = ExcelType.UNKNOWN, IConfiguration configuration = null) where T : class, new()
        {
            if (excelType == ExcelType.UNKNOWN)
            {
                excelType = GetExcelType(stream);
            }

            return(ExcelFacorty.GetExcelProvider(excelType).Query <T>(stream));
        }
示例#4
0
        public static void SaveAs(string filePath, object value, bool printHeader = true, ExcelType excelType = ExcelType.UNKNOWN)
        {
            if (excelType == ExcelType.UNKNOWN)
            {
                excelType = GetExcelType(filePath);
            }

            ExcelFacorty.GetExcelProvider(excelType, printHeader).SaveAs(filePath, value);
        }
示例#5
0
 public static void SaveAs(this Stream stream, object value, bool printHeader = true, ExcelType excelType = ExcelType.XLSX)
 {
     ExcelFacorty.GetExcelProvider(excelType, printHeader).SaveAs(stream, value);
 }
示例#6
0
 public static IEnumerable <dynamic> Query(this Stream stream, bool useHeaderRow = false, string sheetName = null, ExcelType excelType = ExcelType.UNKNOWN, IConfiguration configuration = null)
 {
     return(ExcelFacorty.GetExcelProvider(GetExcelType(stream, excelType), useHeaderRow, sheetName).Query(stream, useHeaderRow));
 }
示例#7
0
 public static IEnumerable <T> Query <T>(this Stream stream, string sheetName = null, ExcelType excelType = ExcelType.UNKNOWN, IConfiguration configuration = null) where T : class, new()
 {
     return(ExcelFacorty.GetExcelProvider(GetExcelType(stream, excelType), sheetName).Query <T>(stream));
 }