本文整理汇总了C#中SS.Spreadsheet类的典型用法代码示例。如果您正苦于以下问题:C# Spreadsheet类的具体用法?C# Spreadsheet怎么用?C# Spreadsheet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Spreadsheet类属于SS命名空间,在下文中一共展示了Spreadsheet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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"));
}
示例2: TestEmptyGetNamesOfCells
public void TestEmptyGetNamesOfCells()
{
Spreadsheet sheet = new Spreadsheet();
var nameEnum = sheet.GetNamesOfAllNonemptyCells().GetEnumerator();
nameEnum.MoveNext();
Assert.IsTrue(nameEnum.Current == null);
}
示例3: Form1
private int wait_time = 0; // This is how many times second_process will run;
#endregion Fields
#region Constructors
/// <summary>
/// Creates a new spread sheet the user can interact with.
/// </summary>
public Form1()
{
InitializeComponent();
//sets the title of the spread sheet to 1 more than the one that opened it.
this.Text = "DangerZone";//"Spreadsheet " + (SpreadsheetApplicationContext.getAppContext().get_form_count() + 1);
my_spread_sheet = new Spreadsheet(IsValid, Normalize, "ps6");
//sets the initial user edit location to the contents box.
contents_box.Select();
spreadsheetPanel1.SelectionChanged += update_display;
spreadsheetPanel1.SetSelection(0, 0);
unprocessed_commands = new Queue<string>();
old_contents = new Queue<string>();
changes_queue = new Queue<string>();
cells_to_recalulate = new HashSet<string>();
change_lock = new object();// This is the lock for when a current change is being done
queue_lock = new object();
command_queue_lock = new object();
cell_name = string.Empty;
spreadsheet_name = string.Empty;
server_ready = true;
waiting = false;
undo_pending = false;
send_ok = false;
ignore_timer = false;
ignore_timer1 = false;
NewForm = null;
OpenForm = null;
}
示例4: Changed
public void Changed()
{
AbstractSpreadsheet ss = new Spreadsheet();
Assert.IsFalse(ss.Changed);
Set(ss, "C1", "17.5");
Assert.IsTrue(ss.Changed);
}
示例5: 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"));
}
示例6: Form1
/// <summary>
/// Constructs a new Spreadsheet when you open a new spreadsheet from the server.
/// </summary>
/// <param name="filepath">Path to file</param>
public Form1(string filepath, string user, int p, string pass)
{
InitializeComponent();
//ss = new Spreadsheet(filepath, isValidName, s => s.ToUpper(), "Spreadsheet");
ss = new Spreadsheet(isValidName, s => s.ToUpper(), filepath);
fileList = new List<string>();
first = false;
//Will this be bad??
scm = new SpreadsheetClientModel();
scm.Connect(user, p, pass);
scm.SendMessage("CREATE" + "\\e" + filepath + "\n");
username = user;
port = p;
password = pass;
version = 0;
filename = filepath;
this.Text = filename;
spreadsheetPanel1.SetSelection(0, 0);
selectedCell.Text = "A1";
selectedValue.Text = "";
editCell.Text = "";
scm.IncomingLineEvent += MessageReceived;
UpdateCell();
//testing success
//new OpenF(this, first);
}
示例7: 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);
}
示例8: TestEmptyGetCellContents
public void TestEmptyGetCellContents()
{
Spreadsheet sheet = new Spreadsheet();
object content = sheet.GetCellContents("A1");
Assert.IsTrue(content.Equals(""));
}
示例9: 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);
}
示例10: 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.SetContentsOfCell(randomName(rand), "3.14");
break;
case 1:
s.SetContentsOfCell(randomName(rand), "hello");
break;
case 2:
s.SetContentsOfCell(randomName(rand), randomFormula(rand));
break;
}
}
catch (CircularException)
{
}
}
ISet<string> set = new HashSet<string>(s.GetNamesOfAllNonemptyCells());
Assert.AreEqual(size, set.Count);
}
示例11: 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"));
}
示例12: 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"));
}
示例13: TestCircularReference4
public void TestCircularReference4()
{
AbstractSpreadsheet sheet = new Spreadsheet();
sheet.SetCellContents("A1", 2.0);
sheet.SetCellContents("A1", new Formula("A1*B1*2/4"));
Assert.Fail();
}
示例14: Form1
/// <summary>
/// Constructor for Empty Spreadsheet Form
/// </summary>
public Form1()
{
InitializeComponent();
ss = new Spreadsheet(Validator, UppercaseString, version);
updateTextBox(spreadsheetPanel1);
}
示例15: GetNamesOfAllNonemptyCellsTest3
public void GetNamesOfAllNonemptyCellsTest3()
{
Spreadsheet test_spreadsheet = new Spreadsheet();
test_spreadsheet.SetCellContents("A1", "x+1");
Assert.AreEqual("A1", new List<string>(test_spreadsheet.GetNamesOfAllNonemptyCells())[0]);
Assert.AreEqual(1, new List<string>(test_spreadsheet.GetNamesOfAllNonemptyCells()).Count);
}