Spread for ASP.NET 9.0 Product Documentation
GetArray Method (DefaultSheetDataModel)
Example 


Gets an object array from a specified range of cells.
Overload List
OverloadDescription
GetArray(Int32,Int32,Int32,Int32)Gets an object array from a specified range of cells.  
GetArray(Int32,Int32,Int32,Int32,Boolean)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)));
}
Requirements

Target Platforms: Windows 7, Windows 8, Windows 10, Windows Vista, Windows Server 2003, Windows Server 2008, Windows Server 2012, Windows XP Professional

See Also

Reference

DefaultSheetDataModel Class
DefaultSheetDataModel Members
SetArray Method

 

 


Copyright © GrapeCity, inc. All rights reserved.