private static void AddExcelData(ExcelFile excelFile)
        {
            var userCollection = new List<User>()
            {
                new User("Rodrigo", "*****@*****.**"),
                new User("Jéssica", "*****@*****.**"),
                new User("Jéssica", "*****@*****.**")
            };
            excelFile.AddSheet<User>("User", userCollection);

            var productCollection = new List<Product>()
            {
                new Product("Bread", 10.5d),
                new Product("Cheese", 3.2d)
            };
            excelFile.AddSheet<Product>("Product", productCollection);
        }
        private static void AddExcelData(ExcelFile excelFile)
        {
            var userCollection = new List <User>()
            {
                new User("Rodrigo", "*****@*****.**"),
                new User("Jéssica", "*****@*****.**"),
                new User("Jéssica", "*****@*****.**")
            };

            excelFile.AddSheet <User>("User", userCollection);

            var productCollection = new List <Product>()
            {
                new Product("Bread", 10.5d),
                new Product("Cheese", 3.2d)
            };

            excelFile.AddSheet <Product>("Product", productCollection);
        }
Пример #3
0
 public static void SetSheet(ref ExcelFile xls, string sheetname)
 {
     if (sheetname != "")
     {
         try
         {
             xls.ActiveSheetByName = sheetname;
         }
         catch
         {
             xls.AddSheet();
             xls.ActiveSheet = xls.SheetCount;
             xls.SheetName   = sheetname;
         }
     }
 }