Spread Silverlight Documentation
AddTable(String,Int32,Int32,Int32,Int32,TableStyle) Method
Example 


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

Parameters

tableName
The table name.
row
The row index.
column
The column index.
rowCount
The row count of the table.
columnCount
The column count of the table.
tableStyle
The style of the table.

Return Value

The new table instance.
Example
This example uses the AddTable method.
gcSpreadSheet1.Sheets[0].Cells[1,1].Text = "Last Name";
gcSpreadSheet1.Sheets[0].Cells[1, 2].Text = "Value";
gcSpreadSheet1.Sheets[0].Cells[2, 1].Text = "Smith";
gcSpreadSheet1.Sheets[0].Cells[2, 2].Value = 50;
gcSpreadSheet1.Sheets[0].Cells[3, 1].Text = "Vil";
gcSpreadSheet1.Sheets[0].Cells[3, 2].Value = 10;
gcSpreadSheet1.Sheets[0].Cells[4, 1].Text = "Press";
gcSpreadSheet1.Sheets[0].Cells[4, 2].Value = 78;
GrapeCity.Windows.SpreadSheet.Data.TableStyleInfo tablestyle = new GrapeCity.Windows.SpreadSheet.Data.TableStyleInfo();
tablestyle.Background = new SolidColorBrush(Colors.Red);
tablestyle.BorderBottom = new GrapeCity.Windows.SpreadSheet.Data.BorderLine(System.Windows.Media.Colors.Purple);
tablestyle.BorderTop = new GrapeCity.Windows.SpreadSheet.Data.BorderLine(System.Windows.Media.Colors.DarkGray);
tablestyle.BorderLeft = new GrapeCity.Windows.SpreadSheet.Data.BorderLine(System.Windows.Media.Colors.Red, GrapeCity.Windows.SpreadSheet.Data.BorderLineStyle.Thick);
tablestyle.BorderRight = new GrapeCity.Windows.SpreadSheet.Data.BorderLine(System.Windows.Media.Colors.Red, GrapeCity.Windows.SpreadSheet.Data.BorderLineStyle.Thick);

GrapeCity.Windows.SpreadSheet.Data.TableStyleInfo tablestylerow = new GrapeCity.Windows.SpreadSheet.Data.TableStyleInfo();
tablestylerow.BorderBottom = new GrapeCity.Windows.SpreadSheet.Data.BorderLine(System.Windows.Media.Colors.Red, GrapeCity.Windows.SpreadSheet.Data.BorderLineStyle.Thick);

GrapeCity.Windows.SpreadSheet.Data.TableStyle testtable = new GrapeCity.Windows.SpreadSheet.Data.TableStyle();
testtable.WholeTableStyle = tablestyle;
testtable.HeaderRowStyle  = tablestylerow;

//gcSpreadSheet1.Sheets[0].AddTable("Table1", 1, 1, 5, 2);
gcSpreadSheet1.Sheets[0].AddTable("Table1", 1, 1, 5, 2, testtable);
gcSpreadSheet1.Invalidate();           
GcSpreadSheet1.Sheets(0).Cells(1, 1).Text = "Last Name"
GcSpreadSheet1.Sheets(0).Cells(1, 2).Text = "Value"
GcSpreadSheet1.Sheets(0).Cells(2, 1).Text = "Smith"
GcSpreadSheet1.Sheets(0).Cells(2, 2).Value = 50
GcSpreadSheet1.Sheets(0).Cells(3, 1).Text = "Vil"
GcSpreadSheet1.Sheets(0).Cells(3, 2).Value = 10
GcSpreadSheet1.Sheets(0).Cells(4, 1).Text = "Press"
GcSpreadSheet1.Sheets(0).Cells(4, 2).Value = 78
Dim tablestyle As New GrapeCity.Windows.SpreadSheet.Data.TableStyleInfo()
tablestyle.Background = New SolidColorBrush(Colors.Red)
tablestyle.BorderBottom = New GrapeCity.Windows.SpreadSheet.Data.BorderLine(System.Windows.Media.Colors.Purple)
tablestyle.BorderTop = New GrapeCity.Windows.SpreadSheet.Data.BorderLine(System.Windows.Media.Colors.DarkGray)
tablestyle.BorderLeft = New GrapeCity.Windows.SpreadSheet.Data.BorderLine(System.Windows.Media.Colors.Red, GrapeCity.Windows.SpreadSheet.Data.BorderLineStyle.Thick)
tablestyle.BorderRight = New GrapeCity.Windows.SpreadSheet.Data.BorderLine(System.Windows.Media.Colors.Red, GrapeCity.Windows.SpreadSheet.Data.BorderLineStyle.Thick)

Dim tablestylerow As New GrapeCity.Windows.SpreadSheet.Data.TableStyleInfo()
tablestylerow.BorderBottom = New GrapeCity.Windows.SpreadSheet.Data.BorderLine(System.Windows.Media.Colors.Red, GrapeCity.Windows.SpreadSheet.Data.BorderLineStyle.Thick)

Dim testtable As New GrapeCity.Windows.SpreadSheet.Data.TableStyle()
testtable.WholeTableStyle = tablestyle
testtable.HeaderRowStyle = tablestylerow

'GcSpreadSheet1.Sheets(0).AddTable("Table1", 1, 1, 5, 2)
GcSpreadSheet1.Sheets(0).AddTable("Table1", 1, 1, 5, 2, testtable)
GcSpreadSheet1.Invalidate()     
See Also

Reference

Worksheet Class
Worksheet Members
Overload List