Spread 8.0 Documentation
Example
Support Options

Glossary Item Box

Example


The following example creates a small data-entry form. The control does not display the column header. In the form, the user must provide data in each cell before proceeding to the next cell. The user can press the Enter key to move to the next cell.

C++

// Set the maximum number of rows
m_Spread.SetMaxRows(5);
// Set the maximum number of columns
m_Spread.SetMaxCols(1);

// Hide the column header
m_Spread.SetColHeadersShow(FALSE);

// Set the active cell to move down when the user presses the Enter key
m_Spread.SetEditEnterAction(EditEnterActionDown);

// Ensure that the user types one row at a time
m_Spread.SetRestrictRows(TRUE):

// Provide text for the rows
// Specify clipping block
m_Spread.SetCol(0);
m_Spread.SetCol2(0);
m_Spread.SetRow(1);
m_Spread.SetRow2(5);
// Clip data into the sheet
m_Spread.SetClip("Name\nAge\nHeight\nWeight\nBlood Type");

// Align the text to the right in the row headers
m_Spread.SetCol(0);
m_Spread.SetRow(-1);
m_Spread.SetTypeHAlign(TypeHAlignRight);

// Set the width of the row header
m_Spread.SetColWidth(0,10);
// Set the height of all the rows
m_Spread.SetRowHeight(-1,14);
// Set the width of the specified column
m_Spread.SetColWidth(1,20);

Visual Basic

' Set the maximum number of rows
fpSpread1.MaxRows = 5
' Set the maximum number of columns
fpSpread1.MaxCols = 1

' Hide the column header
fpSpread1.ColHeadersShow = False

' Set the active cell to move down when the user presses the Enter key
fpSpread1.EditEnterAction = EditEnterActionDown

' Ensure that the user types one row at a time
fpSpread1.RestrictRows = True

' Provide text for the rows
' Specify clipping block
fpSpread1.Col = 0
fpSpread1.Col2 = 0
fpSpread1.Row = 1
fpSpread1.Row2 = 5
' Clip data into the sheet
fpSpread1.Clip = "Name" + Chr$(13) + "Age" + Chr$(13) + "Height" + Chr$(13) + "Weight" + Chr$(13) + "Blood Type"

' Align the text to the right in the row headers
fpSpread1.Col = 0
fpSpread1.Row = -1
fpSpread1.TypeHAlign = TypeHAlignRight

' Set the width of the row header
fpSpread1.ColWidth(0) = 10
' Set the height of all the rows
fpSpread1.RowHeight(-1) = 14
' Set the width of the specified column
fpSpread1.ColWidth(1) = 20

Copyright © GrapeCity, inc. All rights reserved.