public void ToStringTest() { IXLWorksheet ws = new XLWorkbook().Worksheets.Add("Sheet1"); IXLRichText richString = ws.Cell(1, 1).RichText; richString.AddText("Hello"); richString.AddText(" "); richString.AddText("World"); string expected = "Hello World"; string actual = richString.ToString(); Assert.AreEqual(expected, actual); richString.AddText("!"); expected = "Hello World!"; actual = richString.ToString(); Assert.AreEqual(expected, actual); richString.ClearText(); expected = String.Empty; actual = richString.ToString(); Assert.AreEqual(expected, actual); }
public void AccessRichTextTest1() { IXLWorksheet ws = new XLWorkbook().Worksheets.Add("Sheet1"); IXLCell cell = ws.Cell(1, 1); cell.RichText.AddText("12"); cell.DataType = XLCellValues.Number; Assert.AreEqual(12.0, cell.GetDouble()); IXLRichText richText = cell.RichText; Assert.AreEqual("12", richText.ToString()); richText.AddText("34"); Assert.AreEqual("1234", cell.GetString()); Assert.AreEqual(XLCellValues.Number, cell.DataType); Assert.AreEqual(1234.0, cell.GetDouble()); }