Spread for ASP.NET 7.0 Product Documentation
RowTemplate Property
See Also  Example Support Options
FarPoint.Web.Spread Assembly > FarPoint.Web.Spread Namespace > WorksheetTemplate Class : RowTemplate Property


Glossary Item Box

Gets the row template of the sheet.

Syntax

Visual Basic (Declaration) 
Public ReadOnly Property RowTemplate As LayoutTemplate
Visual Basic (Usage)Copy Code
Dim instance As WorksheetTemplate
Dim value As LayoutTemplate
 
value = instance.RowTemplate
C# 
public LayoutTemplate RowTemplate {get;}

Property Value

The row template.

Example

This example creates a template.
C#Copy Code
protected void Page_Load(object sender, System.EventArgs e)
{
if (this.IsPostBack) return;
FpSpread1.ActiveSheetView.LayoutMode = FarPoint.Web.Spread.SheetView.LayoutModeType.RowTemplateLayoutMode;
FarPoint.Web.Spread.WorksheetTemplate template1 = FpSpread1.Sheets[0].WorksheetTemplate;
template1.ColumnCount = 3;
template1.ColumnHeaderTemplate.RowCount = 2;
template1.RowTemplate.RowCount = 2;
template1.LayoutColumns[1].Width = 250;
//Set row template's layout 
template1.RowTemplate.LayoutCells[1, 1].ColumnSpan = 2;
//set column header template's layout
template1.ColumnHeaderTemplate.LayoutCells[0, 0].RowSpan = 2;
template1.ColumnHeaderTemplate.LayoutCells[1, 1].ColumnSpan = 2;

DataTable dt = new DataTable();
dt.Columns.Add("ProductID");
dt.Columns.Add("ProductName");
dt.Columns.Add("Region");
dt.Columns.Add("Date");
dt.Columns.Add("Description");
dt.Rows.Add(new object[] { 21, "Computer", "China", "2010/1/1", "Using newest display adapter" });
dt.Rows.Add(new object[] { 36, "Notebook", "Vietnam", "2010/6/1", "Dell" });
dt.Rows.Add(new object[] { 13, "Hard disk", "Taiwan", "2011/1/1", "Speed is 7200" });
FpSpread1.Sheets[0].DataSource = dt;

template1.LayoutCells[0, 0].DataIndex = 0;
template1.LayoutCells[1, 0].DataIndex = 1;
template1.LayoutCells[0, 1].DataIndex = 2;
template1.LayoutCells[0, 2].DataIndex = 3;
template1.LayoutCells[1, 1].DataIndex = 4;

////Or set RowTemplate's mapping using an older method
//template1.RowTemplate.LayoutCells[0, 0].DataIndex = 0;
//template1.RowTemplate.LayoutCells[1, 0].DataIndex = 1;
//template1.RowTemplate.LayoutCells[0, 1].DataIndex = 2;
//template1.RowTemplate.LayoutCells[0, 2].DataIndex = 3;
//template1.RowTemplate.LayoutCells[1, 1].DataIndex = 4;
////Set ColumnHeaderTemplate's mapping using an older method
//template1.ColumnHeaderTemplate.LayoutCells[0, 0].DataIndex = 0;
//template1.RowTemplate.LayoutCells[1, 0].DataIndex = 1;              //this cell is span in ColumnHeader
//template1.ColumnHeaderTemplate.LayoutCells[0, 1].DataIndex = 2;
//template1.ColumnHeaderTemplate.LayoutCells[0, 2].DataIndex = 3;
//template1.ColumnHeaderTemplate.LayoutCells[1, 1].DataIndex = 4;
}
VB.NETCopy Code
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If (IsPostBack) Then
    Return
End If
FpSpread1.ActiveSheetView.LayoutMode = FarPoint.Web.Spread.SheetView.LayoutModeType.RowTemplateLayoutMode
Dim template1 As FarPoint.Web.Spread.WorksheetTemplate = FpSpread1.Sheets(0).WorksheetTemplate
template1.ColumnCount = 3
template1.ColumnHeaderTemplate.RowCount = 2
template1.RowTemplate.RowCount = 2
template1.LayoutColumns(1).Width = 250
'Set row template's layout 
template1.RowTemplate.LayoutCells(1, 1).ColumnSpan = 2
'set column header template's layout
template1.ColumnHeaderTemplate.LayoutCells(0, 0).RowSpan = 2
template1.ColumnHeaderTemplate.LayoutCells(1, 1).ColumnSpan = 2

Dim dt As New DataTable()
dt.Columns.Add("ProductID")
dt.Columns.Add("ProductName")
dt.Columns.Add("Region")
dt.Columns.Add("Date")
dt.Columns.Add("Description")
dt.Rows.Add(New Object() {21, "Computer", "China", "2010/1/1", "Using newest display adapter"})
dt.Rows.Add(New Object() {36, "Notebook", "Vietnam", "2010/6/1", "Dell"})
dt.Rows.Add(New Object() {13, "Hard disk", "Taiwan", "2011/1/1", "Speed is 7200"})
FpSpread1.Sheets(0).DataSource = dt

template1.LayoutCells(0, 0).DataIndex = 0
template1.LayoutCells(1, 0).DataIndex = 1
template1.LayoutCells(0, 1).DataIndex = 2
template1.LayoutCells(0, 2).DataIndex = 3
template1.LayoutCells(1, 1).DataIndex = 4

'Set RowTemplate's mapping using an older method
'template1.RowTemplate.LayoutCells(0, 0).DataIndex = 0
'template1.RowTemplate.LayoutCells(1, 0).DataIndex = 1
'template1.RowTemplate.LayoutCells(0, 1).DataIndex = 2
'template1.RowTemplate.LayoutCells(0, 2).DataIndex = 3
'template1.RowTemplate.LayoutCells(1, 1).DataIndex = 4
'Set ColumnHeaderTemplate's mapping using an older method
'template1.ColumnHeaderTemplate.LayoutCells(0, 0).DataIndex = 0
'template1.RowTemplate.LayoutCells(1, 0).DataIndex = 1            'this cell is span in ColumnHeader
'template1.ColumnHeaderTemplate.LayoutCells(0, 1).DataIndex = 2
'template1.ColumnHeaderTemplate.LayoutCells(0, 2).DataIndex = 3
'template1.ColumnHeaderTemplate.LayoutCells(1, 1).DataIndex = 4
End Sub

Requirements

Target Platforms: Windows 7, Windows 8, Windows Vista, Windows Server 2000, Windows 2000 Professional, Windows XP Professional, Windows NT 4.0 Workstation, SP6, Windows NT 4.0 Server, SP6

See Also

© 2002-2014 ComponentOne, a division of GrapeCity. All Rights Reserved.