GrapeCity.Xaml.SpreadSheet.Data
AddTable(String,Int32,Int32,Object,TableStyle) Method
Example 


GrapeCity.Xaml.SpreadSheet.Data Namespace > Worksheet Class > AddTable Method : AddTable(String,Int32,Int32,Object,TableStyle) Method
The table name.
The row index.
The column index.
The data source for the table.
The style of the table.
Adds a range table with a specified data source to the sheet.
Syntax
'Declaration
 
Public Overloads Function AddTable( _
   ByVal tableName As String, _
   ByVal row As Integer, _
   ByVal column As Integer, _
   ByVal datasource As Object, _
   ByVal tableStyle As TableStyle _
) As SheetTable
'Usage
 
Dim instance As Worksheet
Dim tableName As String
Dim row As Integer
Dim column As Integer
Dim datasource As Object
Dim tableStyle As TableStyle
Dim value As SheetTable
 
value = instance.AddTable(tableName, row, column, datasource, tableStyle)
public SheetTable AddTable( 
   string tableName,
   int row,
   int column,
   object datasource,
   TableStyle tableStyle
)

Parameters

tableName
The table name.
row
The row index.
column
The column index.
datasource
The data source for the table.
tableStyle
The style of the table.

Return Value

The new table instance.
Example
This example creates a table.
public class lname
        {
            public string last { get; set; }
            public int val { get; set; }
            public lname(string last, int val)
            {
                this.last = last;
                this.val = val;
            }
        }

private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            lname[] arr = new lname[] { new lname("Smith", 100), new lname("Fender", 3), new lname("Gill", 5), new lname("Johnson", 8) };

            GrapeCity.Xaml.SpreadSheet.Data.TableStyleInfo tablestyle = new GrapeCity.Xaml.SpreadSheet.Data.TableStyleInfo();
            tablestyle.Background = new SolidColorBrush(Windows.UI.Colors.Azure);
            tablestyle.BorderBottom = new GrapeCity.Xaml.SpreadSheet.Data.BorderLine(Windows.UI.Colors.DarkOrchid);
            tablestyle.BorderTop = new GrapeCity.Xaml.SpreadSheet.Data.BorderLine(Windows.UI.Colors.DarkSlateBlue);
            tablestyle.BorderLeft = new GrapeCity.Xaml.SpreadSheet.Data.BorderLine(Windows.UI.Colors.Crimson, GrapeCity.Xaml.SpreadSheet.Data.BorderLineStyle.Thick);
            tablestyle.BorderRight = new GrapeCity.Xaml.SpreadSheet.Data.BorderLine(Windows.UI.Colors.Crimson, GrapeCity.Xaml.SpreadSheet.Data.BorderLineStyle.Thick);
            GrapeCity.Xaml.SpreadSheet.Data.TableStyleInfo tablestylerow = new GrapeCity.Xaml.SpreadSheet.Data.TableStyleInfo();
            tablestylerow.BorderBottom = new GrapeCity.Xaml.SpreadSheet.Data.BorderLine(Windows.UI.Colors.Crimson, GrapeCity.Xaml.SpreadSheet.Data.BorderLineStyle.Thick);
            GrapeCity.Xaml.SpreadSheet.Data.TableStyle testtable = new GrapeCity.Xaml.SpreadSheet.Data.TableStyle();
            testtable.WholeTableStyle = tablestyle;
            testtable.HeaderRowStyle = tablestylerow;
            gcSpreadSheet1.Sheets[0].AddTable("Table1", 1, 1, arr, testtable);                     
        }
Public Class lname
    Public Property last() As String
        Get
            Return m_last
        End Get
        Set
            m_last = Value
        End Set
    End Property
    Private m_last As String
    Public Property val() As Integer
        Get
            Return m_val
        End Get
        Set
            m_val = Value
        End Set
    End Property
    Private m_val As Integer
    Public Sub New(last As String, val As Integer)
        Me.last = last
        Me.val = val
    End Sub
End Class

Private Sub MainPage_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
        Dim arr As lname() = New lname() {New lname("Smith", 100), New lname("Fender", 3), New lname("Gill", 5), New lname("Johnson", 8)}
        Dim tablestyle As New GrapeCity.Xaml.SpreadSheet.Data.TableStyleInfo()
        tablestyle.Background = New SolidColorBrush(Windows.UI.Colors.Azure)
        tablestyle.BorderBottom = New GrapeCity.Xaml.SpreadSheet.Data.BorderLine(Windows.UI.Colors.DarkOrchid)
        tablestyle.BorderTop = New GrapeCity.Xaml.SpreadSheet.Data.BorderLine(Windows.UI.Colors.DarkSlateBlue)
        tablestyle.BorderLeft = New GrapeCity.Xaml.SpreadSheet.Data.BorderLine(Windows.UI.Colors.Crimson, GrapeCity.Xaml.SpreadSheet.Data.BorderLineStyle.Thick)
        tablestyle.BorderRight = New GrapeCity.Xaml.SpreadSheet.Data.BorderLine(Windows.UI.Colors.Crimson, GrapeCity.Xaml.SpreadSheet.Data.BorderLineStyle.Thick)
        Dim tablestylerow As New GrapeCity.Xaml.SpreadSheet.Data.TableStyleInfo()
        tablestylerow.BorderBottom = New GrapeCity.Xaml.SpreadSheet.Data.BorderLine(Windows.UI.Colors.Crimson, GrapeCity.Xaml.SpreadSheet.Data.BorderLineStyle.Thick)
        Dim testtable As New GrapeCity.Xaml.SpreadSheet.Data.TableStyle()
        testtable.WholeTableStyle = tablestyle
        testtable.HeaderRowStyle = tablestylerow
        gcSpreadSheet1.Sheets(0).AddTable("Table1", 1, 1, arr, testtable)
    End Sub
See Also

Reference

Worksheet Class
Worksheet Members
Overload List