Spread ASP.NET 17
FarPoint.Web.Spread Assembly / FarPoint.Web.Spread.Model Namespace / DefaultSheetDataModel Class / GetArray Method
Example


In This Topic
    GetArray Method (DefaultSheetDataModel)
    In This Topic
    Gets an object array from a specified range of cells.
    Overload List
    OverloadDescription
    Gets an object array from a specified range of cells.  
    Gets an object array from a specified range of cells.  
    Remarks
    Before you use the method, you must declare the array as the type of array needed to contain the data to be returned from the spreadsheet.
    Example
    This example adds data to the first three columns. In the click event of a button, the data is handled as an array and returned to a list box.
    PrivateSubPage_Load(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesMyBase.Load
    
    If(Me.IsPostBack)ThenReturn
    
    DimiAsInteger
    Fori=0To2
    FpSpread1.ActiveSheetView.SetValue(i,0,i)
    FpSpread1.ActiveSheetView.SetValue(i,1,i)
    FpSpread1.ActiveSheetView.SetValue(i,2,i)
    Next
    
    EndSub
    
    PrivateSubButton1_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton1.Click
    DimdmAsFarPoint.Web.Spread.Model.DefaultSheetDataModel=CType(FpSpread1.ActiveSheetView.DataModel,FarPoint.Web.Spread.Model.DefaultSheetDataModel)
    Dimarr(,)AsObject
    arr=dm.GetArray(0,0,2,2)
    ListBox1.Items.Add(Convert.ToString(arr.GetLowerBound(1)))
    EndSub
    privatevoidPage_Load(objectsender,System.EventArgse)
    {
    if(this.IsPostBack)return;
    
    FpSpread1.ActiveSheetView.RowCount=10;
    for(inti=0;i<4;i++)
    {
    FpSpread1.ActiveSheetView.SetValue(i,0,i);
    FpSpread1.ActiveSheetView.SetValue(i,1,i);
    FpSpread1.ActiveSheetView.SetValue(i,2,i);
    }
    }
    
    privatevoidButton1_Click(objectsender,System.EventArgse)
    {
    FarPoint.Web.Spread.Model.DefaultSheetDataModeldm=(FarPoint.Web.Spread.Model.DefaultSheetDataModel)FpSpread1.ActiveSheetView.DataModel;
    object[,]arr;
    arr=dm.GetArray(0,0,2,2);
    ListBox1.Items.Add(Convert.ToString(arr.GetLowerBound(1)));
    }
    See Also