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


GrapeCity.Xaml.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 String, _
   ByVal row As Integer, _
   ByVal column As Integer, _
   ByVal rowCount As Integer, _
   ByVal columnCount As Integer, _
   ByVal tableStyle As TableStyle _
) As SheetTable
'Usage
 
Dim instance As Worksheet
Dim tableName As String
Dim row As Integer
Dim column As Integer
Dim rowCount As Integer
Dim columnCount As Integer
Dim tableStyle As TableStyle
Dim value As SheetTable
 
value = instance.AddTable(tableName, row, column, rowCount, columnCount, tableStyle)
public SheetTable AddTable( 
   string tableName,
   int row,
   int column,
   int rowCount,
   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 creates a table.
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.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, 5, 2);
gcSpreadSheet1.Sheets[0].AddTable("Table1", 1, 1, 5, 2, testtable);  
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.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, 5, 2)
GcSpreadSheet1.Sheets(0).AddTable("Table1", 1, 1, 5, 2, testtable)
See Also

Reference

Worksheet Class
Worksheet Members
Overload List