MESCIUS SPREAD for ASP.NET 10.0J
GetView メソッド

ビューの名前を含む文字列
データソースコントロールに関連付けられた名前付きデータソースビューを取得します。
構文
'Declaration
 
Public Function GetView( _
   ByVal viewName As String _
) As DataSourceView
public DataSourceView GetView( 
   string viewName
)

パラメータ

viewName
ビューの名前を含む文字列

戻り値の型

SpreadDataSourceViewオブジェクト

次のサンプルコードは、セル範囲を連結した後、SpreadDataSourceクラスおよびSpreadDataSourceViewクラスの各種メソッドを使用します。

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());
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"

Dim spreadDS As New FarPoint.Web.Spread.SpreadDataSource()
spreadDS.SheetName = FpSpread1.ActiveSheetView.SheetName
spreadDS.SpreadID = "FpSpread1"
spreadDS.CellRange = New FarPoint.Web.Spread.Model.CellRange(0, 0, 3, 1)

'Add the Spread Data Source to the page
Controls.Add(spreadDS)

Dim spreadDSV = New FarPoint.Web.Spread.SpreadDataSourceView(spreadDS)
ListBox1.Items.Add(spreadDSV.CanDelete.ToString())
ListBox1.Items.Add(spreadDSV.CanInsert.ToString())
ListBox1.Items.Add(spreadDSV.CanUpdate.ToString())
ListBox1.Items.Add(spreadDSV.CanSort.ToString())

' for GetData() method
Dim enmrable As System.Collections.IEnumerable
Dim enmr As System.Collections.IEnumerator
enmrable = spreadDS.GetData()
enmr = enmrable.GetEnumerator()
ListBox1.DataTextField = "UserName"
While enmr.MoveNext()
   ListBox1.Items.Add(Convert.ToString(enmr.Current))
End While

' for GetViewNames() method
Dim c As System.Collections.ICollection
c = spreadDS.GetViewNames()
 Dim arr(2) As String
c.CopyTo(arr, 0)
ListBox1.Items.Add(c.Count.ToString())
If arr(0) = "" Then
   ListBox1.Items.Add("return correct value")
End If

' for GetView() method
Dim DSView As System.Web.UI.DataSourceView
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())
参照

SpreadDataSource クラス
SpreadDataSource メンバ

 

 


© MESCIUS inc. All rights reserved.