本文整理汇总了C#中SS.Spreadsheet类的典型用法代码示例。如果您正苦于以下问题:C# Spreadsheet类的具体用法?C# Spreadsheet怎么用?C# Spreadsheet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Spreadsheet类属于SS命名空间,在下文中一共展示了Spreadsheet类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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"));
}
开发者ID:jiiehe,项目名称:cs3500,代码行数:26,代码来源:SpreadsheetTests.cs
示例2: TestEmptyGetNamesOfCells
public void TestEmptyGetNamesOfCells()
{
Spreadsheet sheet = new Spreadsheet();
var nameEnum = sheet.GetNamesOfAllNonemptyCells().GetEnumerator();
nameEnum.MoveNext();
Assert.IsTrue(nameEnum.Current == null);
}
开发者ID:HeroOfCanton,项目名称:CS3500,代码行数:7,代码来源:UnitTest1.cs
示例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;
}
开发者ID:RyanJones0814,项目名称:spreadsheet,代码行数:37,代码来源:Form1.cs
示例4: Changed
public void Changed()
{
AbstractSpreadsheet ss = new Spreadsheet();
Assert.IsFalse(ss.Changed);
Set(ss, "C1", "17.5");
Assert.IsTrue(ss.Changed);
}
开发者ID:jiiehe,项目名称:cs3500,代码行数:7,代码来源:GradingTests.cs
示例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"));
}
开发者ID:Buck417,项目名称:Second-Half-CS-3500,代码行数:7,代码来源:SpreadsheetTests.cs
示例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);
}
开发者ID:hodgeskyjon,项目名称:3505_Spring_Project,代码行数:35,代码来源:Form1.cs
示例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);
}
开发者ID:drewmacmac,项目名称:old_class,代码行数:7,代码来源:PS5Tester.cs
示例8: TestEmptyGetCellContents
public void TestEmptyGetCellContents()
{
Spreadsheet sheet = new Spreadsheet();
object content = sheet.GetCellContents("A1");
Assert.IsTrue(content.Equals(""));
}
开发者ID:HeroOfCanton,项目名称:CS3500,代码行数:7,代码来源:UnitTest1.cs
示例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);
}
开发者ID:drewmacmac,项目名称:old_class,代码行数:7,代码来源:PS5Tester.cs
示例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);
}
开发者ID:drewmacmac,项目名称:old_class,代码行数:28,代码来源:UnitTest1.cs
示例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"));
}
开发者ID:Buck417,项目名称:Second-Half-CS-3500,代码行数:7,代码来源:SpreadsheetTests.cs
示例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"));
}
开发者ID:Buck417,项目名称:Second-Half-CS-3500,代码行数:7,代码来源:SpreadsheetTests.cs
示例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();
}
开发者ID:Leyalic,项目名称:PS6_2015,代码行数:7,代码来源:SpreadsheetTests.cs
示例14: Form1
/// <summary>
/// Constructor for Empty Spreadsheet Form
/// </summary>
public Form1()
{
InitializeComponent();
ss = new Spreadsheet(Validator, UppercaseString, version);
updateTextBox(spreadsheetPanel1);
}
开发者ID:Buck417,项目名称:Second-Half-CS-3500,代码行数:10,代码来源:Form1.cs
示例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);
}
开发者ID:Buck417,项目名称:First-Half-CS-3500,代码行数:7,代码来源:SpreadsheetTests.cs
示例16: Form1
/// <summary>
/// new constructor with spreasheet as parameter, and Spreadsheetmodel
/// it will call the spreadsheet model constructor first
/// </summary>
/// <param name="ss"></param>
public Form1(Spreadsheet ss, SpreadsheetModel ssm)
: this()
{
this.ss = ss;
this.spreadsheetmodel = ssm;
BindingModelEvent();
}
开发者ID:keivnlee,项目名称:Spreadsheet,代码行数:12,代码来源:Form1.cs
示例17: 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
示例18: NewTest11
public void NewTest11()
{
Spreadsheet s = new Spreadsheet(x => true, x => x, "\"default\"");
s.SetContentsOfCell("a1", "Text");
s.Save("..\\..\\..\\Test.xml");
string sversion = s.GetSavedVersion("..\\..\\..\\Test.xml");
Assert.AreEqual("\"default\"", sversion);
}
开发者ID:hodgeskyjon,项目名称:3505_Spring_Project,代码行数:8,代码来源:UnitTest1.cs
示例19: ChangedTest
public void ChangedTest()
{
string existing_path = @"..\..\..\SpreadSheetTests\validspreadsheet.xml"; // the .. means up a directory
Spreadsheet target = new Spreadsheet(existing_path, s => true, s => s.ToUpper(), "dan1");
Assert.AreEqual(false, target.Changed);
target.SetContentsOfCell("A1", "33");
Assert.AreEqual(true, target.Changed);
}
开发者ID:amozoss,项目名称:CS3505,代码行数:9,代码来源:SpreadsheetTest.cs
示例20: Form1
/// <summary>
/// Creates a new empty spreadsheet
/// </summary>
public Form1()
{
InitializeComponent();
myModel = new SpreadsheetModel.SSModel();
myModel.CreateOK += ValidSS;
myModel.CreateFail += InvalidSS;
myModel.JoinOK += successJoin;
myModel.JoinFail += failJoin;
myModel.ChangeOk += successChange;
myModel.ChangeWait += waitChange;
myModel.ChangeFail += failChange;
myModel.UndoOk += successUndo;
myModel.UndoEnd += endUndo;
myModel.UndoWait += waitUndo;
myModel.UndoFail += failUndo;
myModel.Update += update;
myModel.SaveOk += successSave;
myModel.SaveFail += failSave;
myModel.Error += error;
myModel.Test += tester;
myModel.noConnection += connectError;
myModel.invalidIP += badip;
tabControl1.Appearance = TabAppearance.Buttons;
tabControl1.SizeMode = TabSizeMode.Fixed;
tabControl1.ItemSize = new System.Drawing.Size(0, 1);
mySheet = new Spreadsheet(s => true/*Regex.IsMatch(s, "(^([a-z]|[A-Z])\\d+$)")*/, s => s.ToUpper(), "ps6");
numWindows++;
int mycol;
int myRow;
int colLetter;
string myVal;
object content;
//this.textBox1.Invoke(new Action(()=>textBox1.Clear()));
textBox1.Clear();
//this.spreadsheetPanel1.Invoke(new Action(()=>spreadsheetPanel1.GetSelection(out mycol1, out myRow1)));
spreadsheetPanel1.GetSelection(out mycol, out myRow);
content = mySheet.GetCellContents(GetCellName(mycol, myRow));
if (content is Formula)
{
//this.textBox1.Invoke(new Action(()=>textBox1.Text = "=" + content.ToString()));
textBox1.Text = "=" + content.ToString();
}
else
{
//this.textBox1.Invoke(new Action(()=>textBox1.Text = content.ToString()));
textBox1.Text = content.ToString();
}
//this.spreadsheetPanel1.Invoke(new Action(()=>spreadsheetPanel1.GetValue(mycol1, myRow1, out myal1)));
spreadsheetPanel1.GetValue(mycol, myRow, out myVal);
colLetter = mycol + 65;
//this.textBox2.Invoke(new Action(()=>textBox2.Text = ((char)colLetter).ToString() + (myRow1 + 1).ToString() + "= " + myval1));
textBox2.Text=((char)colLetter).ToString()+(myRow+1).ToString()+"= "+myVal;
//this.Invoke(new Action(()=>this.Text = "Spreadsheet"));
this.Text = "Spreadsheet";
}
开发者ID:HyveMynd,项目名称:CloudSpreadSheet,代码行数:60,代码来源:Form1.cs
注:本文中的SS.Spreadsheet类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论