FarPoint.Web.Spread 名前空間 > SheetView クラス : RowFilter プロパティ |
'Declaration
Public Property RowFilter As IRowFilter
public IRowFilter RowFilter {get; set;}
次のサンプルコードは、行のフィルタを設定します。
string conStr = "Provider=Microsoft.JET.OLEDB.4.0;data source= C:\\Patients2000.mdb"; string sqlStr = "SELECT * FROM Patients"; System.Data.OleDb.OleDbConnection conn = new System.Data.OleDb.OleDbConnection(conStr); DataSet ds = new DataSet(); System.Data.OleDb.OleDbDataAdapter daCust = new System.Data.OleDb.OleDbDataAdapter(sqlStr, conn); daCust.Fill(ds); FpSpread1.DataSource = ds; FarPoint.Web.Spread.FilterColumnDefinition fcd = new FarPoint.Web.Spread.FilterColumnDefinition(1, FarPoint.Web.Spread.FilterListBehavior.SortByMostOccurrences | FarPoint.Web.Spread.FilterListBehavior.Default); FarPoint.Web.Spread.FilterColumnDefinition fcd1 = new FarPoint.Web.Spread.FilterColumnDefinition(2); FarPoint.Web.Spread.FilterColumnDefinition fcd2 = new FarPoint.Web.Spread.FilterColumnDefinition(3); FarPoint.Web.Spread.HideRowFilter hf = new FarPoint.Web.Spread.HideRowFilter(FpSpread1.ActiveSheetView); hf.AddColumn(fcd); hf.AddColumn(fcd1); hf.AddColumn(fcd2); FpSpread1.ActiveSheetView.RowFilter = hf;
Dim conStr As String = "Provider=Microsoft.JET.OLEDB.4.0;data source= C:\Patients2000.mdb" Dim sqlStr As String = "SELECT * FROM Patients" Dim conn As System.Data.OleDb.OleDbConnection = New System.Data.OleDb.OleDbConnection(conStr) Dim ds As DataSet = New DataSet Dim daCust As System.Data.OleDb.OleDbDataAdapter = New System.Data.OleDb.OleDbDataAdapter(sqlStr, conn) daCust.Fill(ds) FpSpread1.DataSource = ds Dim fcd As New FarPoint.Web.Spread.FilterColumnDefinition(1, FarPoint.Web.Spread.FilterListBehavior.SortByMostOccurrences Or FarPoint.Web.Spread.FilterListBehavior.Default) Dim fcd1 As New FarPoint.Web.Spread.FilterColumnDefinition(2) Dim fcd2 As New FarPoint.Web.Spread.FilterColumnDefinition(3) Dim hf As New FarPoint.Web.Spread.HideRowFilter(FpSpread1.ActiveSheetView) hf.AddColumn(fcd) hf.AddColumn(fcd1) hf.AddColumn(fcd2) FpSpread1.ActiveSheetView.RowFilter = hf
FarPoint.Web.Spread.NamedStyle instyle = new FarPoint.Web.Spread.NamedStyle(); FarPoint.Web.Spread.NamedStyle outstyle = new FarPoint.Web.Spread.NamedStyle(); instyle.BackColor = Color.Yellow; outstyle.BackColor = Color.Gray; FarPoint.Web.Spread.StyleRowFilter rf = new FarPoint.Web.Spread.StyleRowFilter(FpSpread1.Sheets[0], instyle, outstyle); FpSpread1.Sheets[0].RowFilter = rf; // Assign filter and customize filter options. FpSpread1.Sheets[0].RowFilter.AddColumn(1); FpSpread1.Sheets[0].RowFilter.ShowFilterIndicator = true; FpSpread1.Sheets[0].RowFilter.AllString = "Show All"; FpSpread1.Sheets[0].RowFilter.BlanksString = "Show The Blanks"; FpSpread1.Sheets[0].RowFilter.NonBlanksString = "Show The Non-Blanks";
Dim instyle As New FarPoint.Web.Spread.NamedStyle() Dim outstyle As New FarPoint.Web.Spread.NamedStyle() instyle.BackColor = Color.Yellow outstyle.BackColor = Color.Gray Dim rf As New FarPoint.Web.Spread.StyleRowFilter(FpSpread1.Sheets(0), instyle, outstyle) FpSpread1.Sheets(0).RowFilter = rf ' Assign filter and customize filter options. FpSpread1.Sheets(0).RowFilter.AddColumn(1) FpSpread1.Sheets(0).RowFilter.ShowFilterIndicator = True FpSpread1.Sheets(0).RowFilter.AllString = "Show All" FpSpread1.Sheets(0).RowFilter.BlanksString = "Show The Blanks" FpSpread1.Sheets(0).RowFilter.NonBlanksString = "Show The Non-Blanks"