本文整理汇总了C#中SS.Spreadsheet.GetCellContents方法的典型用法代码示例。如果您正苦于以下问题:C# Spreadsheet.GetCellContents方法的具体用法?C# Spreadsheet.GetCellContents怎么用?C# Spreadsheet.GetCellContents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SS.Spreadsheet
的用法示例。
在下文中一共展示了Spreadsheet.GetCellContents方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetStringContentTwice
public void SetStringContentTwice()
{
Spreadsheet sheet = new Spreadsheet();
sheet.SetCellContents("A1", "blue");
sheet.SetCellContents("A1", "green");
Assert.AreEqual(sheet.GetCellContents("A1"), "green");
Assert.AreNotEqual(sheet.GetCellContents("A1"), "blue");
}
示例2: GetValueFormula01
public void GetValueFormula01()
{
Spreadsheet sheet = new Spreadsheet(s => true, s => s, "default");
sheet.SetContentsOfCell("D1", "=5");
Assert.AreEqual(sheet.GetCellContents("D1"), new Formula("5"));
Assert.AreEqual(sheet.GetCellValue("D1"), (double)5);
}
示例3: GetValueDoubleEmptyConstructor
public void GetValueDoubleEmptyConstructor()
{
Spreadsheet sheet = new Spreadsheet();
sheet.SetContentsOfCell("D1", "5");
Assert.AreEqual(sheet.GetCellContents("D1"), (double)5);
Assert.AreEqual(sheet.GetCellValue("D1"), (double)5);
}
示例4: GetCellContentsDoubleCellExistsTest
public void GetCellContentsDoubleCellExistsTest()
{
Spreadsheet s = new Spreadsheet();
Assert.AreEqual(true, s.SetContentsOfCell("a1", "2.0").Contains("a1"));
Assert.AreEqual(true, s.SetContentsOfCell("a1", "5.3").Contains("a1"));
Assert.AreEqual(5.3, s.GetCellContents("a1"));
}
示例5: TestEmptyGetCellContents
public void TestEmptyGetCellContents()
{
Spreadsheet sheet = new Spreadsheet();
object content = sheet.GetCellContents("A1");
Assert.IsTrue(content.Equals(""));
}
示例6: GetCellContentsStringCellExistsTest
public void GetCellContentsStringCellExistsTest()
{
Spreadsheet s = new Spreadsheet();
Assert.AreEqual(true, s.SetContentsOfCell("a1", "Hey there").Contains("a1"));
Assert.AreEqual(true, s.SetContentsOfCell("a1", "What's up?").Contains("a1"));
Assert.AreEqual("What's up?", s.GetCellContents("a1"));
}
示例7: GetCellContentsStringTest
public void GetCellContentsStringTest()
{
//Gets the contents of a string-type cell
Spreadsheet s = new Spreadsheet();
s.SetContentsOfCell("a1", "Hey there");
Assert.AreEqual("Hey there", s.GetCellContents("a1"));
}
示例8: TestConstructor
public void TestConstructor()
{
//just some stuff with filewriting
Assert.IsTrue(sheet1.IsValid("any old string"));
Assert.IsTrue(sheet1.Normalize("dead") == "dead");
Assert.IsTrue(sheet1.Version == "default");
//test 3 arg constructor
sheet1 = new Spreadsheet(s => (s.Length >= 2) ? true : false,
s => s.Replace(" ", ""),
"version1");
Assert.IsTrue(sheet1.IsValid("A1"));
Assert.IsFalse(sheet1.IsValid("A"));
Assert.IsTrue(sheet1.Normalize("d e a d") == "dead");
Assert.IsTrue(sheet1.Version == "version1");
sheet1.SetContentsOfCell("A 1","loaded!");
string savePath = "save 1.xml";
sheet1.Save(savePath);
sheet1 = new Spreadsheet(
savePath,
s => (s.Length >= 2) ? true : false,
s => s.Replace(" ", ""),
"version1");
Assert.AreEqual("loaded!",(string)sheet1.GetCellContents("A1"));
}
示例9: GetCellContentsFormula
public void GetCellContentsFormula()
{
Spreadsheet sheet = new Spreadsheet();
sheet.SetCellContents("A1", "blue");
sheet.SetCellContents("A1", "green");
sheet.SetCellContents("B1", "purple");
sheet.SetCellContents("C1", "red");
sheet.SetCellContents("D1", new Formula("C1 + 2 + X1"));
Assert.AreEqual(sheet.GetCellContents("D1"), new Formula("C1+2+X1"));
}
示例10: TestConstructor1
public void TestConstructor1()
{
AbstractSpreadsheet sheet = new Spreadsheet();
Assert.AreEqual("", sheet.GetCellContents("A1"));
Assert.AreEqual("", sheet.GetCellContents("B1"));
Assert.AreEqual("", sheet.GetCellContents("D1"));
Assert.AreEqual("", sheet.GetCellContents("AA1"));
Assert.AreEqual("", sheet.GetCellContents("Jim"));
Assert.AreEqual("", sheet.GetCellContents("ab1"));
}
示例11: CreateSaveLoadSpreadsheet
public void CreateSaveLoadSpreadsheet()
{
Spreadsheet sheet = new Spreadsheet();
sheet.SetContentsOfCell("D1", "=5");
sheet.SetContentsOfCell("C1", "=4.5");
sheet.SetContentsOfCell("E1", "apples");
sheet.SetContentsOfCell("G1", "-2");
sheet.SetContentsOfCell("H1", "-4");
sheet.SetContentsOfCell("F1", "= G1 + H1");
sheet.Save(@"MyXml2.xml");
Spreadsheet sheet2 = new Spreadsheet(@"MyXml2.xml", s => true, s => s, "default");
Assert.AreEqual(sheet2.GetCellContents("D1"), new Formula("5"));
Assert.AreEqual(sheet2.GetCellContents("C1"), new Formula("4.5"));
Assert.AreEqual(sheet2.GetCellContents("E1"), "apples");
Assert.AreEqual(sheet2.GetCellContents("G1"), (double)-2);
Assert.AreEqual(sheet2.GetCellContents("H1"), (double)-4);
Assert.AreEqual(sheet2.GetCellContents("F1"), new Formula("G1 + H1"));
Assert.AreEqual(sheet2.GetCellValue("F1"), (double)-6);
}
示例12: NormalizeTest1
public void NormalizeTest1()
{
AbstractSpreadsheet s = new Spreadsheet();
s.SetContentsOfCell("B1", "hello");
Assert.AreEqual("", s.GetCellContents("b1"));
}
示例13: Test1400
public void Test1400()
{
Spreadsheet s = new Spreadsheet();
s.SetContentsOfCell("Z7", "=3");
Formula f = (Formula)s.GetCellContents("Z7");
Assert.AreEqual(new Formula("3"), f);
Assert.AreNotEqual(new Formula("2"), f);
}
示例14: Test1000
public void Test1000()
{
Spreadsheet s = new Spreadsheet();
s.SetContentsOfCell("Z7", "hello");
Assert.AreEqual("hello", s.GetCellContents("Z7"));
}
示例15: TestRead3
public void TestRead3()
{
string path = "read3.xml";
Spreadsheet sheet = new Spreadsheet();
sheet.SetContentsOfCell("a1", "=1.5+4");
sheet.SetContentsOfCell("b2", "=a2-2.6");
sheet.SetContentsOfCell("c3", "=3.7*e5");
sheet.SetContentsOfCell("d4", "hil");
sheet.SetContentsOfCell("e5", "5.9");
sheet.Save(path);
HashSet<string> original = (HashSet<string>)sheet.GetNamesOfAllNonemptyCells();
Spreadsheet sheet2 = new Spreadsheet(path, x => true, s => s, "default");
foreach (string s in original) {
Assert.IsTrue(sheet.GetCellContents(s).Equals(sheet2.GetCellContents(s)));
Assert.IsTrue(sheet.GetCellValue(s).Equals(sheet2.GetCellValue(s)));
}
}