本文整理汇总了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]));
}
}
}
示例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));
}
示例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));
}
示例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);
}
示例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);
}
}
}
示例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);
}
}
}