Spread WinRT Documentation > Developer's Guide > Managing the User Interface > Creating Tables |
You can display data in a table in the control. The table has options to filter or sort the data.
You can use default styles for the table or create custom styles for the table or various sections of the table with the TableStyle class. The following image displays a default table style:
You can use a cell range or the DataSource property for the table data.
The row count for the table includes the header and footer rows. Tables support frozen rows and columns, sparklines, conditional formats, and cell spans. You can cut, copy, or paste the table data.
Tables can be exported to or imported from Excel-formatted files.
A cell can only exist in one table.
Use the AddTable method to add a table.
This example creates a table.
CS |
Copy Code |
---|---|
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 Grid_Loaded_1(object sender, RoutedEventArgs e) { lname[] arr = new lname[] { new lname("Smith", 100), new lname("Fender", 3), new lname("Gill", 5) }; gcSpreadSheet1.Sheets[0].AddTable("Table1", 0, 0, arr); } |
VB |
Copy Code |
---|---|
Public Class lname Public Property last() As String Get Return m_last End Get Set(value As String) m_last = Value End Set End Property Private m_last As String Public Property val() As Integer Get Return m_val End Get Set(value As Integer) 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)} gcSpreadSheet1.Sheets(0).AddTable("Table1", 0, 0, arr) End Sub |