示例#1
0
        public void TestOpen()
        {
            ExcelDocument doc = null;

            using (MemoryStream ms = new MemoryStream(EXCEL.ToByteArrayFromBase64String()))
            {
                doc = ExcelDocument.OpenDocument(ms);
                Assert.AreEqual(4, doc.GetAllWorksheets().Length);
            }

            ExcelWorksheet worksheet = doc.GetAllWorksheets()[0];
            ExcelFormatter formatter = worksheet.GetFormatterAt(
                new ExcelCellName(new ColumnLetter(Letter.A), 1),
                new ExcelCellName(new ColumnLetter(Letter.C), 3));

            Assert.AreEqual(Color.FromArgb(0, 255, 0, 0), formatter.Background);
            Assert.AreEqual(Color.FromArgb(0, 255, 255, 0), formatter.Foreground);

            doc.Dispose();
        }