当前位置: 首页>>代码示例>>C#>>正文


C# Spreadsheet.SetCellContents方法代码示例

本文整理汇总了C#中SS.Spreadsheet.SetCellContents方法的典型用法代码示例。如果您正苦于以下问题:C# Spreadsheet.SetCellContents方法的具体用法?C# Spreadsheet.SetCellContents怎么用?C# Spreadsheet.SetCellContents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SS.Spreadsheet的用法示例。


在下文中一共展示了Spreadsheet.SetCellContents方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestCircularReference4

 public void TestCircularReference4()
 {
     AbstractSpreadsheet sheet = new Spreadsheet();
     sheet.SetCellContents("A1", 2.0);
     sheet.SetCellContents("A1", new Formula("A1*B1*2/4"));
     Assert.Fail();
 }
开发者ID:Leyalic,项目名称:PS6_2015,代码行数:7,代码来源:SpreadsheetTests.cs

示例2: GetNamesOfAllNonemptyCellsTest4

        public void GetNamesOfAllNonemptyCellsTest4()
        {
            Spreadsheet test_spreadsheet = new Spreadsheet();
            test_spreadsheet.SetCellContents("A1", "x+1");
            test_spreadsheet.SetCellContents("A1", "");

            Assert.AreEqual(0, new List<string>(test_spreadsheet.GetNamesOfAllNonemptyCells()).Count);
        }
开发者ID:Buck417,项目名称:First-Half-CS-3500,代码行数:8,代码来源:SpreadsheetTests.cs

示例3: 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");
 }
开发者ID:drewmacmac,项目名称:old_class,代码行数:8,代码来源:UnitTest1.cs

示例4: 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"));
        }
开发者ID:drewmacmac,项目名称:old_class,代码行数:11,代码来源:UnitTest1.cs

示例5: GetNamesOfAllNonemptyCellsTest2

 public void GetNamesOfAllNonemptyCellsTest2()
 {
     Spreadsheet test_spreadsheet = new Spreadsheet();
     test_spreadsheet.SetCellContents("A1", new Formula("x+1"));
     Assert.AreEqual("A1", new List<string>(test_spreadsheet.GetNamesOfAllNonemptyCells())[0]);
     Assert.AreEqual(1, new List<string>(test_spreadsheet.GetNamesOfAllNonemptyCells()).Count);
 }
开发者ID:Buck417,项目名称:First-Half-CS-3500,代码行数:7,代码来源:SpreadsheetTests.cs

示例6: TestGetNamesOfNonEmptyCells

        public void TestGetNamesOfNonEmptyCells()
        {
            Spreadsheet sheet = new Spreadsheet();
            sheet.SetCellContents("A1", 10.5);
            sheet.SetCellContents("B1", "horse");
            sheet.SetCellContents("E1", 1.5);
            sheet.SetCellContents("A", "dad");

            var nameEnum = sheet.GetNamesOfAllNonemptyCells().GetEnumerator();

            List<object> names = new List<object>();
            for (int i = 0; i < 4; i++)
            {
                nameEnum.MoveNext();
                names.Add(nameEnum.Current);
            }
            
            Assert.IsTrue(names.Count == 4);

            Assert.IsTrue(names.Contains("A1"));
            Assert.IsTrue(names.Contains("B1"));
            Assert.IsTrue(names.Contains("E1"));
            Assert.IsTrue(names.Contains("A"));
        }
开发者ID:HeroOfCanton,项目名称:CS3500,代码行数:24,代码来源:UnitTest1.cs

示例7: RunRandomizedTest

 public void RunRandomizedTest (int seed, int size) 
 {
     Spreadsheet s = new Spreadsheet();
     Random rand = new Random(seed);
     for (int i = 0; i < 10000; i++)
     {
         try
         {
             switch (rand.Next(3))
             {
                 case 0:
                     s.SetCellContents(randomName(rand), 3.14);
                     break;
                 case 1:
                     s.SetCellContents(randomName(rand), "hello");
                     break;
                 case 2:
                     s.SetCellContents(randomName(rand), randomFormula(rand));
                     break;
             }
         }
         catch (CircularException)
         {
         }
     }
     ISet<string> set = new HashSet<string>(s.GetNamesOfAllNonemptyCells());
     Assert.AreEqual(size, set.Count);
 }
开发者ID:jimibue,项目名称:cs3505,代码行数:28,代码来源:PS4_GradingTests.cs

示例8: Test39

 public void Test39()
 {
     Spreadsheet s = new Spreadsheet();
     for (int i = 1; i < 200; i++)
     {
         s.SetCellContents("A" + i, new Formula("A" + (i + 1)));
     }
     try
     {
         s.SetCellContents("A150", new Formula("A50"));
         Assert.Fail();
     }
     catch (CircularException)
     {
     }
 }
开发者ID:jimibue,项目名称:cs3505,代码行数:16,代码来源:PS4_GradingTests.cs

示例9: Test31

 public void Test31()
 {
     Spreadsheet s = new Spreadsheet();
     s.SetCellContents("A1", new Formula("B1+B2"));
     s.SetCellContents("B1", new Formula("C1-C2"));
     s.SetCellContents("B2", new Formula("C3*C4"));
     s.SetCellContents("C1", new Formula("D1*D2"));
     s.SetCellContents("C2", new Formula("D3*D4"));
     s.SetCellContents("C3", new Formula("D5*D6"));
     s.SetCellContents("C4", new Formula("D7*D8"));
     s.SetCellContents("D1", new Formula("E1"));
     s.SetCellContents("D2", new Formula("E1"));
     s.SetCellContents("D3", new Formula("E1"));
     s.SetCellContents("D4", new Formula("E1"));
     s.SetCellContents("D5", new Formula("E1"));
     s.SetCellContents("D6", new Formula("E1"));
     s.SetCellContents("D7", new Formula("E1"));
     s.SetCellContents("D8", new Formula("E1"));
     ISet<String> cells = s.SetCellContents("E1", 0);
     Assert.IsTrue(new HashSet<string>(){"A1", "B1", "B2", "C1", "C2", "C3", "C4", "D1", "D2", "D3", "D4", "D5", "D6", "D7", "D8", "E1"}.SetEquals(cells));
 }
开发者ID:jimibue,项目名称:cs3505,代码行数:21,代码来源:PS4_GradingTests.cs

示例10: Test29

 public void Test29()
 {
     Spreadsheet s = new Spreadsheet();
     s.SetCellContents("A1", new Formula("A2+A3"));
     s.SetCellContents("A1", "Hello");
     Assert.AreEqual("Hello", (string)s.GetCellContents("A1"));
 }
开发者ID:jimibue,项目名称:cs3505,代码行数:7,代码来源:PS4_GradingTests.cs

示例11: Test27

 public void Test27()
 {
     Spreadsheet s = new Spreadsheet();
     s.SetCellContents("A1", new Formula("A2+A3"));
     s.SetCellContents("A2", 6);
     s.SetCellContents("A3", new Formula("A2+A4"));
     s.SetCellContents("A4", new Formula("A2+A5"));
     Assert.IsTrue(s.SetCellContents("A5", 82.5).SetEquals(new HashSet<string>() { "A5", "A4", "A3", "A1" }));
 }
开发者ID:jimibue,项目名称:cs3505,代码行数:9,代码来源:PS4_GradingTests.cs

示例12: Test23

 public void Test23()
 {
     Spreadsheet s = new Spreadsheet();
     s.SetCellContents("A1", 17.2);
     s.SetCellContents("C1", "hello");
     s.SetCellContents("B1", new Formula("3.5"));
     Assert.IsTrue(new HashSet<string>(s.GetNamesOfAllNonemptyCells()).SetEquals(new HashSet<string>() { "A1", "B1", "C1" }));
 }
开发者ID:jimibue,项目名称:cs3505,代码行数:8,代码来源:PS4_GradingTests.cs

示例13: Test10

 public void Test10()
 {
     Spreadsheet s = new Spreadsheet();
     s.SetCellContents("Z7", "hello");
     Assert.AreEqual("hello", s.GetCellContents("Z7"));
 }
开发者ID:jimibue,项目名称:cs3505,代码行数:6,代码来源:PS4_GradingTests.cs

示例14: Test9

 public void Test9()
 {
     Spreadsheet s = new Spreadsheet();
     s.SetCellContents("1AZ", "hello");
 }
开发者ID:jimibue,项目名称:cs3505,代码行数:5,代码来源:PS4_GradingTests.cs

示例15: Test8

 public void Test8()
 {
     Spreadsheet s = new Spreadsheet();
     s.SetCellContents(null, "hello");
 }
开发者ID:jimibue,项目名称:cs3505,代码行数:5,代码来源:PS4_GradingTests.cs


注:本文中的SS.Spreadsheet.SetCellContents方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。