Spread Windows Forms 9.0 Product Documentation
DataAutoCellTypes Property (SpreadDataBindingAdapter)
Example 


Gets or sets whether the cell type is set automatically when filling data.
Syntax
'Declaration
 
Public Property DataAutoCellTypes As Boolean
'Usage
 
Dim instance As SpreadDataBindingAdapter
Dim value As Boolean
 
instance.DataAutoCellTypes = value
 
value = instance.DataAutoCellTypes
public bool DataAutoCellTypes {get; set;}

Property Value

Boolean: true if the cell type is set automatically when filling data; false otherwise
Example
This example sets the DataAutoCellTypes property.
DataSet ds = new DataSet();
DataTable dt = default(DataTable);
dt = new DataTable();
dt.Columns.Add(new DataColumn("Number1", typeof(string)));
dt.Columns.Add(new DataColumn("Number2", typeof(string)));
dt.Columns.Add(new DataColumn("Number3", typeof(string)));
dt.Columns.Add(new DataColumn("Text1", typeof(string)));
dt.Columns.Add(new DataColumn("Text2", typeof(string)));
dt.Columns.Add(new DataColumn("Text3", typeof(string)));
dt.Columns.Add(new DataColumn("Text4", typeof(decimal)));
dt.Rows.Add(new object[] { "101", "1", "0", "Num1", "Num2", "Num3", 21000 });
dt.Rows.Add(new object[] { "201", "2", "0", "a", "b", "c", 9400 });
dt.Rows.Add(new object[] { "203", "2", "0", "Jan", "Feb", "March", 4550 });
dt.Rows.Add(new object[] { "301", "3", "1", "First", "Second", "Third", 32000 });
dt.Rows.Add(new object[] { "302", "3", "1", "Test", "Test1", "Test2", 13280 });
dt.Rows.Add(new object[] { "204", "2", "0", "Mon", "Tues", "Wed", 1700 });
dt.Rows.Add(new object[] { "303", "3", "1", "Week1", "Week2", "Week3", 36080 });
dt.Rows.Add(new object[] { "402", "4", "1", "d", "e", "f", 31500 });
dt.Rows.Add(new object[] { "405", "4", "1", "July", "August", "September", 4958 });
dt.Rows.Add(new object[] { "102", "1", "0", "next", "aaa", "max", 1539 });
ds.Tables.Add(dt);

FarPoint.Win.Spread.Data.SpreadDataBindingAdapter Sdba = new FarPoint.Win.Spread.Data.SpreadDataBindingAdapter();
Sdba.DataSource = ds.Tables[0];
Sdba.Spread = fpSpread1;
Sdba.SheetName = fpSpread1.ActiveSheet.SheetName;
Sdba.AutoGenerateRow = true;
Sdba.DataAutoCellTypes = false;  
Sdba.MapperInfo = new FarPoint.Win.Spread.Data.MapperInfo(2, 0, 10, 7);   
Sdba.FillSpreadDataByDataSource();
Dim ds As New DataSet()
Dim dt As DataTable = Nothing
dt = New DataTable()
dt.Columns.Add(New DataColumn("Number1", GetType(String)))
dt.Columns.Add(New DataColumn("Number2", GetType(String)))
dt.Columns.Add(New DataColumn("Number3", GetType(String)))
dt.Columns.Add(New DataColumn("Text1", GetType(String)))
dt.Columns.Add(New DataColumn("Text2", GetType(String)))
dt.Columns.Add(New DataColumn("Text3", GetType(String)))
dt.Columns.Add(New DataColumn("Text4", GetType(Decimal)))
dt.Rows.Add(New Object() {"101", "1", "0", "Num1", "Num2", "Num3", 21000})
dt.Rows.Add(New Object() {"201", "2", "0", "a", "b", "c", 9400})
dt.Rows.Add(New Object() {"203", "2", "0", "Jan", "Feb", "March", 4550})
dt.Rows.Add(New Object() {"301", "3", "1", "First", "Second", "Third", 32000})
dt.Rows.Add(New Object() {"302", "3", "1", "Test", "Test1", "Test2", 13280})
dt.Rows.Add(New Object() {"204", "2", "0", "Mon", "Tues", "Wed", 1700})
dt.Rows.Add(New Object() {"303", "3", "1", "Week1", "Week2", "Week3", 36080})
dt.Rows.Add(New Object() {"402", "4", "1", "d", "e", "f", 31500})
dt.Rows.Add(New Object() {"405", "4", "1", "July", "August", "September", 4958})
dt.Rows.Add(New Object() {"102", "1", "0", "next", "aaa", "max", 1539})
ds.Tables.Add(dt)

Dim Sdba As New FarPoint.Win.Spread.Data.SpreadDataBindingAdapter()
Sdba.DataSource = ds.Tables(0)
Sdba.Spread = FpSpread1
Sdba.SheetName = FpSpread1.ActiveSheet.SheetName
Sdba.AutoGenerateRow = True
Sdba.DataAutoCellTypes = False
Sdba.MapperInfo = New FarPoint.Win.Spread.Data.MapperInfo(2, 0, 10, 7)
Sdba.FillSpreadDataByDataSource()
Requirements

Target Platforms: Windows 2000 Professional (SP4), Windows 2000 Server, Windows 2003 Server (SP1), Windows Server 2012 R2, Windows 2008, Windows XP (SP2), Windows Vista, Windows 7, Windows 8, Windows 8.1, Windows 10

See Also

Reference

SpreadDataBindingAdapter Class
SpreadDataBindingAdapter Members

 

 


Copyright © GrapeCity, inc. All rights reserved.