public ColumnLayout(ExcelWorksheet sheet)
 {
     IdColumn          = ExcelPackageHelper.GetColumnCharForHeader(sheet, ID_HEADER);
     DescriptionColumn = ExcelPackageHelper.GetColumnCharForHeader(sheet, DESCRIPTION_HEADER);
     if (DescriptionColumn == null)
     {
         DescriptionColumn = ExcelPackageHelper.GetColumnCharForHeader(sheet, OLD_DESCRIPTION_HEADER);
     }
     StatusColumn     = ExcelPackageHelper.GetColumnCharForHeader(sheet, STATUS_HEADER);
     CategoryColumn   = ExcelPackageHelper.GetColumnCharForHeader(sheet, CATEGORY_HEADER);
     CreateDateColumn = ExcelPackageHelper.GetColumnCharForHeader(sheet, CREATE_DATE_HEADER);
     DoneDateColumn   = ExcelPackageHelper.GetColumnCharForHeader(sheet, DONE_DATE_HEADER);
 }
Ejemplo n.º 2
0
        public void ExcelPackageHelper_GetColumnCharForHeader()
        {
            //arrange
            ExcelPackage   package   = new ExcelPackage();
            string         name      = "Title";
            ExcelWorksheet worksheet = ExcelPackageHelper.AddWorksheet(package, name);
            List <string>  headers   = new List <string>()
            {
                "ColA", "ColB", "ColC"
            };

            //act
            ExcelPackageHelper.AppendRow(worksheet, headers);
            string a = ExcelPackageHelper.GetColumnCharForHeader(worksheet, headers[0]);
            string b = ExcelPackageHelper.GetColumnCharForHeader(worksheet, headers[1]);
            string c = ExcelPackageHelper.GetColumnCharForHeader(worksheet, headers[2]);
            string d = ExcelPackageHelper.GetColumnCharForHeader(worksheet, "Other");

            //assert
            Assert.AreEqual("A", a);
            Assert.AreEqual("B", b);
            Assert.AreEqual("C", c);
            Assert.IsNull(d);
        }