Exemple #1
0
        public void CreateSpreadSheetTable()
        {
            ContextDbService service = new ContextDbService();
            var context = service.GetDbContext();

            var tableGenerator = new TableGeneratorExcel();

            var fileName = $"Customers {DateTime.Now.ToString().Replace("/", "").Replace(":", "")}.xlsx";

            tableGenerator.Run(context.Customers.ToList(), "Customers", fileName);
        }
Exemple #2
0
        public void CreateTable()
        {
            ContextDbService service = new ContextDbService();
            var context = service.GetDbContext();

            var tableGenerator = new TableGeneratorPowerPoint();

            var customers = context.Customers.Select(c => new { c.ContactName, c.CompanyName, c.ContactTitle, c.Address, c.City, c.Country });

            var fileName = $"Customers {DateTime.Now.ToString().Replace("/", "_").Replace(":", "_")}.ppt";

            tableGenerator.Run(customers, "Customers", fileName);
        }
        public void GenerateTable()
        {
            ContextDbService service = new ContextDbService();
            var context = service.GetDbContext();

            // we need to use anonoymus type so set the custom label names
            var Customers = context.Customers.Select(x => new
            {
                FullName = x.ContactName,
                Company  = x.CompanyName,
                JobTitle = x.ContactTitle,
                x.Address,
                x.City,
            }).ToList();

            var tableGenerator = new TableGeneratorWord();

            var fileName = $"Customers {DateTime.Now.ToString().Replace("/", "").Replace(":", "")}.docx";

            tableGenerator.Run(Customers, "Customers", fileName);
        }