Ejemplo n.º 1
0
        public void TestAddList()
        {
            var excelReport = new ExcelReport("TestAddList", "Unknown", "sheet 1");

            excelReport.AddEmptyRows(5);


            var pesonList = new List <TestPerson>();

            for (int rowIndex = 1; rowIndex < 30000; rowIndex++)
            {
                var person = new TestPerson
                {
                    Age       = rowIndex,
                    FirstName = "Ivan",
                    LastName  = "Ivanov"
                };

                pesonList.Add(person);
            }

            excelReport.AddList(pesonList);

            excelReport.AddLogo(0, 0);

            excelReport.SaveToExcelFile(@"c:\\PesonList.xls");
        }
Ejemplo n.º 2
0
        public void TestManyData()
        {
            var excelReport = new ExcelReport("Test many data", "Unknown", "sheet 1");

            excelReport.AddEmptyRows(5);
            excelReport.AddLogo(0, 0);

            for (int rowIndex = 1; rowIndex < 30000; rowIndex++)
            {
                for (int columnIndex = 1; columnIndex < 20; columnIndex++)
                {
                    excelReport.AddCell(rowIndex * columnIndex, columnIndex, rowIndex, TextStyle.NormalText);
                }
            }

            excelReport.SaveToExcelFile(@"c:\\TestManyData.xls");
        }
Ejemplo n.º 3
0
        public void TestManyDataWithBorder()
        {
            var excelReport = new ExcelReport("Test many data with border", "Unknown", "sheet 1");

            excelReport.AddEmptyRows(5);
            excelReport.AddLogo(0, 0);

            for (int rowIndex = 1; rowIndex < 30000; rowIndex++)
            {
                var row = excelReport.GetNextRow();
                for (int columnIndex = 1; columnIndex < 20; columnIndex++)
                {
                    excelReport.AddCell(rowIndex * columnIndex, columnIndex, row, TextStyle.NormalText, HSSFColor.WHITE.index, CellBorderType.THIN, HSSFColor.BLACK.index);
                }
            }

            excelReport.SaveToExcelFile(@"c:\\TestManyDataWithBorder.xls");
        }
Ejemplo n.º 4
0
        public void TestCellAdd2()
        {
            var excelReport = new ExcelReport("Test many data", "Unknown", "sheet 1");

            excelReport.AddEmptyRows(5);
            excelReport.AddLogo(0, 0);

            for (int rowIndex = 1; rowIndex < 30000; rowIndex++)
            {
                //var row = excelReport.GetNextRow();
                for (int columnIndex = 1; columnIndex < 20; columnIndex++)
                {
                    //excelReport.AddCell(rowIndex * columnIndex, columnIndex, row, TextStyle.NormalText);
                    excelReport.AddCell("test " + columnIndex + rowIndex, columnIndex, rowIndex, TextStyle.NormalText, HSSFColor.WHITE.index, CellBorderType.NONE, HSSFColor.WHITE.index);
                }
            }

            excelReport.SaveToExcelFile(@"c:\\TestCellAdd2.xls");
        }
Ejemplo n.º 5
0
        public void TestAddListWitCustomColums()
        {
            var excelReport = new ExcelReport("TestAddListWitCustomColums", "Unknown", "sheet 1");

            excelReport.AddEmptyRows(5);

            var pesonList = new List <TestPerson>();

            for (int rowIndex = 1; rowIndex < 30000; rowIndex++)
            {
                var person = new TestPerson
                {
                    Age       = rowIndex % 100,
                    FirstName = "Ivan",
                    LastName  = "Ivanov"
                };

                pesonList.Add(person);
            }

            var columns = new List <DataColumn> {
                DataColumn.GetRowNumberColumn("№"),
                new DataColumn {
                    FieldAlias = "Фамилия", FieldName = "LastName", ExcelColumWidth = 20
                },
                new DataColumn {
                    FieldAlias = "Имя", FieldName = "FirstName", ExcelColumWidth = 20
                },
                new DataColumn {
                    FieldAlias = "Возраст", FieldName = "Age", ExcelColumWidth = 20
                }
            };

            excelReport.AddList(pesonList, columns);

            excelReport.AddLogo(0, 0);

            excelReport.SaveToExcelFile(@"c:\\PesonListWitCustomColums.xls");
        }