예제 #1
0
        public void ExportWithAttributesAndSomeSheetsNames()
        {
            IList <DummyPersonWithAttributes> dummyPeopleSheet1 = new List <DummyPersonWithAttributes>();
            IList <DummyPersonWithAttributes> dummyPeopleSheet2 = new List <DummyPersonWithAttributes>();
            IList <DummyPersonWithAttributes> dummyPeopleSheet3 = new List <DummyPersonWithAttributes>();

            for (int index = 0; index < 30; index++)
            {
                dummyPeopleSheet1.Add(DummyFactory.CreateDummyPersonWithAttributes());
            }

            for (int index = 0; index < 50; index++)
            {
                dummyPeopleSheet2.Add(DummyFactory.CreateDummyPersonWithAttributes());
            }

            for (int index = 0; index < 25; index++)
            {
                dummyPeopleSheet3.Add(DummyFactory.CreateDummyPersonWithAttributes());
            }

            IExcelExportEngine engine = new ExcelExportEngine();

            engine.AsExcel().SetFormat(ExcelVersion.XLS);
            engine.AsExcel().AddData(dummyPeopleSheet1, "Sheet Number 1");
            engine.AsExcel().AddData(dummyPeopleSheet2, "Another Sheet");
            engine.AsExcel().AddData(dummyPeopleSheet3, "Custom Name");
            var fileName = Guid.NewGuid().ToString() + "-with-attributes-some-sheets.xls";
            var filePath = PathConfig.BASE_PATH + fileName;

            engine.Export(filePath);
        }
예제 #2
0
        public void ExportWithAttributes()
        {
            IList <DummyPersonWithAttributes> dummyPeople = new List <DummyPersonWithAttributes>();

            for (int index = 0; index < 30; index++)
            {
                dummyPeople.Add(DummyFactory.CreateDummyPersonWithAttributes());
            }

            IExportEngine engine = new ExcelExportEngine();

            engine.AddData(dummyPeople);
            var fileName = Guid.NewGuid().ToString() + "-with-attributes.xlsx";
            var filePath = PathConfig.BASE_PATH + fileName;

            engine.Export(filePath);
        }
예제 #3
0
        public void ExportWithAttributesAndRuntimeRename()
        {
            IList <DummyPersonWithAttributes> dummyPeople = new List <DummyPersonWithAttributes>();

            for (int index = 0; index < 30; index++)
            {
                dummyPeople.Add(DummyFactory.CreateDummyPersonWithAttributes());
            }

            IExportEngine engine = new ExcelExportEngine();
            var           key    = engine.AddData(dummyPeople);

            engine.AddColumnsNames <DummyPersonWithAttributes>(key, x => x.Name, "this is a new name LOL!");
            var fileName = Guid.NewGuid().ToString() + "-with-runtime-rename.xlsx";
            var filePath = PathConfig.BASE_PATH + fileName;

            engine.Export(filePath);
        }