Exemplo n.º 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);
 }
Exemplo n.º 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));
        }
Exemplo n.º 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));
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
 }
Exemplo n.º 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));
 }
Exemplo n.º 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));
 }