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


C# AbstractSpreadsheet.GetCellValue方法代码示例

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


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

示例1: VV

        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion

        // Verifies cells and their values, which must alternate.
        public void VV(AbstractSpreadsheet sheet, params object[] constraints)
        {
            for (int i = 0; i < constraints.Length; i += 2)
            {
                if (constraints[i + 1] is double)
                {
                    Assert.AreEqual((double)constraints[i + 1], (double)sheet.GetCellValue((string)constraints[i]), 1e-9);
                }
                else
                {
                    Assert.AreEqual(constraints[i + 1], sheet.GetCellValue((string)constraints[i]));
                }
            }
        }
开发者ID:HeroOfCanton,项目名称:CS3500,代码行数:44,代码来源:UnitTest1.cs

示例2: DivisionByZero1

 public void DivisionByZero1(AbstractSpreadsheet ss)
 {
     Set(ss, "A1", "4.1");
     Set(ss, "B1", "0.0");
     Set(ss, "C1", "= A1 / B1");
     Assert.IsInstanceOfType(ss.GetCellValue("C1"), typeof(FormulaError));
 }
开发者ID:jiiehe,项目名称:cs3500,代码行数:7,代码来源:GradingTests.cs

示例3: StringArgument

 public void StringArgument(AbstractSpreadsheet ss)
 {
     Set(ss, "A1", "4.1");
     Set(ss, "B1", "hello");
     Set(ss, "C1", "= A1 + B1");
     Assert.IsInstanceOfType(ss.GetCellValue("C1"), typeof(FormulaError));
 }
开发者ID:unaveed,项目名称:Spreadsheet,代码行数:7,代码来源:MyUnitTests.cs

示例4: Formula1

 public void Formula1(AbstractSpreadsheet ss)
 {
     Set(ss, "a1", "= a2 + a3");
     Set(ss, "a2", "= b1 + b2");
     Assert.IsInstanceOfType(ss.GetCellValue("a1"), typeof(FormulaError));
     Assert.IsInstanceOfType(ss.GetCellValue("a2"), typeof(FormulaError));
     Set(ss, "a3", "5.0");
     Set(ss, "b1", "2.0");
     Set(ss, "b2", "3.0");
     VV(ss, "a1", 10.0, "a2", 5.0);
     Set(ss, "b2", "4.0");
     VV(ss, "a1", 11.0, "a2", 6.0);
 }
开发者ID:unaveed,项目名称:Spreadsheet,代码行数:13,代码来源:MyUnitTests.cs

示例5: openToolStripMenuItem_Click

        /// <summary>
        /// deals with open a new file
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {

            //check if orignal file has been changed if so ask if they want to save.
            String message = "Would you like to save before closing?";
            var result1 = MessageBox.Show(message, "Closing", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (result1 == DialogResult.Yes)
                saveFile();
           
            
            //With help from www.dotnetperls.com
            //show dialog
            DialogResult result = openFileDialog1.ShowDialog();
            //check result
            if (result == DialogResult.OK)
            {
                string fileName = openFileDialog1.FileName;
                
                try
                {
                    //make new spreadsheet
                    SSModel = new Spreadsheet(fileName, s => Regex.IsMatch(s, @"^[a-zA-Z][1-9][0-9]?$"), s => s.ToUpper(), "ps6");
                    //fill in the cells in the GUI
                    foreach (String cellName in SSModel.GetNamesOfAllNonemptyCells())
                    {
                        setRowAndCol(cellName);
                        spreadsheetPanel1.SetValue(col, row, SSModel.GetCellValue(cellName).ToString());
                    }

                    //set up the spreadsheet
                    spreadsheetPanel1.SetSelection(0, 0);
                    displayCurrentCell(0, 0);

                }catch(Exception ex )
                {
                    MessageBox.Show("An error occured:\n "+ ex.Message);
                }
            }
        }
开发者ID:jimibue,项目名称:cs3505,代码行数:44,代码来源:Form1.cs

示例6: SYNCEvent

        private void SYNCEvent(String command)
        {
            //you need to create a spreadsheet here.
            ss = new Spreadsheet();
            String[] temp = CommandParser(command);
            ss.Version = temp[1];

            for (int i = 2; i < temp.Length && (i + 1) < temp.Length; i+=2)
            {
                String cell_name = temp[i];
                String cell_content = temp[i+1];
                ISet<string> CellToRecalculate = ss.SetContentsOfCell(cell_name, cell_content);

                //update the all the relative cell value on the spreadsheet panel
                //get the value of the namede cells, and convert to string
                object value = ss.GetCellValue(cell_name);
                string v;
                if (value is double)
                    v = (double)value + "";
                else if (value is string)
                    v = (string)value;
                else
                    v = "FormulaError";

                //set the value to the panel
                int col = cell_name.First() - 'A';
                int row = row = Int32.Parse(cell_name.Substring(1, cell_name.Length - 1)) - 1;
                spreadsheetPanel1.SetValue(col, row, v);

                //value of each dependent cell in the spreadsheet will be updated
                foreach (string s in CellToRecalculate)
                {
                    value = ss.GetCellValue(s);
                    col = s.First() - 'A';
                    row = Int32.Parse(s.Substring(1, s.Length - 1)) - 1;
                    spreadsheetPanel1.SetValue(col, row, "" + value);
                }
            }
        }
开发者ID:keivnlee,项目名称:finalverionspreadsheet,代码行数:39,代码来源:Form1.cs


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