FpSpread1.Sheets[0].ColumnHeader.Cells[0, 0].Value = "UserName";
FpSpread1.Sheets[0].Cells[0, 0].Value = "Test";
FpSpread1.Sheets[0].Cells[1, 0].Value = "Ann";
FpSpread1.Sheets[0].Cells[2, 0].Value = "Doug";
FarPoint.Web.Spread.SpreadDataSource spreadDS = new FarPoint.Web.Spread.SpreadDataSource();
spreadDS.SheetName = FpSpread1.ActiveSheetView.SheetName;
spreadDS.SpreadID = "FpSpread1";//FpSpread1.ID;
spreadDS.CellRange = new FarPoint.Web.Spread.Model.CellRange(0, 0, 3, 1);
//Add the Spread data source to the page
this.Controls.Add(spreadDS);
// GetData() method
System.Collections.IEnumerable enmrable;
System.Collections.IEnumerator enmr;
enmrable = spreadDS.GetData();
enmr = enmrable.GetEnumerator();
ListBox1.DataTextField = "UserName";
while (enmr.MoveNext())
{
ListBox1.Items.Add(Convert.ToString(enmr.Current));
}
// GetViewNames() method
System.Collections.ICollection c;
c = spreadDS.GetViewNames();
string[] arr= new string[2];
c.CopyTo(arr, 0);
ListBox1.Items.Add(c.Count.ToString());
if (arr[0] == "")
{
ListBox1.Items.Add("return correct value");
}
// GetView() method
System.Web.UI.DataSourceView DSView;
DSView = spreadDS.GetView(arr[0]);
ListBox1.Items.Add(DSView.CanDelete.ToString());
ListBox1.Items.Add(DSView.CanInsert.ToString());
ListBox1.Items.Add(DSView.CanUpdate.ToString());
ListBox1.Items.Add(DSView.CanSort.ToString());