Spread Windows Forms 10.0 Product Documentation > Developer's Guide > Customizing Sheet Interaction > Customizing Interaction with a Sheet > Creating Tables > Understanding Structured References > Using Structured References |
You can add structured references to tables using the Formula property.
A cell outside of the table can have a formula with a table reference; however, the table name must be unique among table names and custom names. The table name must also be valid.
Set the Formula property for the cell.
This example code sums the Value column in the table.
C# |
Copy Code
|
---|---|
fpSpread1.Sheets[0].Cells[1, 1].Text = "Last Name"; fpSpread1.Sheets[0].Cells[1, 2].Text = "Value"; fpSpread1.Sheets[0].Cells[2, 1].Text = "Smith"; fpSpread1.Sheets[0].Cells[2, 2].Value = 50; fpSpread1.Sheets[0].Cells[3, 1].Text = "Vil"; fpSpread1.Sheets[0].Cells[3, 2].Value = 10; fpSpread1.Sheets[0].Cells[4, 1].Text = "Press"; fpSpread1.Sheets[0].Cells[4, 2].Value = 78; fpSpread1.Sheets[0].AddTable("table", 1, 1, 5, 2); fpSpread1.Sheets[0].Cells[5, 1].Formula = "SUM(table[Value])"; |
VB |
Copy Code
|
---|---|
FpSpread1.Sheets(0).Cells(1, 1).Text = "Last Name" FpSpread1.Sheets(0).Cells(1, 2).Text = "Value" FpSpread1.Sheets(0).Cells(2, 1).Text = "Smith" FpSpread1.Sheets(0).Cells(2, 2).Value = 50 FpSpread1.Sheets(0).Cells(3, 1).Text = "Vil" FpSpread1.Sheets(0).Cells(3, 2).Value = 10 FpSpread1.Sheets(0).Cells(4, 1).Text = "Press" FpSpread1.Sheets(0).Cells(4, 2).Value = 78 FpSpread1.Sheets(0).AddTable("table", 1, 1, 5, 2) FpSpread1.Sheets(0).Cells(5, 1).Formula = "SUM(table[Value])" |