Пример #1
0
        /// <summary>
        /// Exports the data supplied to an excel workbook
        /// </summary>
        /// <param name="rowData">The data to be exported to the workbook</param>
        /// <param name="formatter"></param>
        public void WriteDataToExport(IEnumerable<IEnumerable<Cell>> rowData, CellFormatter formatter, ExcelFileType excelFileType)
        {
            if (excelFileType == ExcelFileType.XLS)
            {
                ExcelExporter = new ExcelXlsExporter();
            }

            ExcelExporter.WriteDataToExport(rowData, formatter, "Sheet 1");
        }
        public void Should_return_stream_with_data()
        {
            MemoryStream outputStream = new MemoryStream();
            ExcelExport target = new ExcelExport();
             CellFormatter formatter = new CellFormatter();

            target.WriteDataToExport(sampleData, formatter,ExcelFileType.XLS);

            target.ExportToStream(outputStream);

            Assert.IsTrue(outputStream.Length > 0);
        }
        public void Setup()
        {
            target = new CellFormatter();
            workBook = Helper.CreateWorkBookWithSheet();

            sampleData = new List<List<Cell>>
                              {
                                  new List<Cell>
                                  {
                                    new Cell {Value = "1"},
                                    new Cell {Value = "2", IsBold = true},
                                    new Cell {Value = "a"},
                                    new Cell {Value = "b", IsBold = true},
                                  }
                              };
        }
        public void Setup()
        {
            sut = new ExcelExport();
            formatter = new CellFormatter();
            workBook = Helper.CreateWorkBookWithSheet();

            sampleData = new List<List<Cell>>
                              {
                                  new List<Cell>
                                  {
                                    new Cell {Value = "1"},
                                    new Cell {Value = "2"},
                                    new Cell {Value = "a"},
                                    new Cell {Value = "b"},
                                  }
                              };
        }