Spread 8.0 Documentation
Example
Support Options

Glossary Item Box

Example


The following example creates a sheet with three columns that contain numeric values. All columns display spin buttons that do not wrap when the cells are in edit mode. The first column increments the spin amount by one, the second column's spin button increments by two, and the third column's spin button increments by three.

C++

// Set the number of columns in the sheet
m_Spread1.MaxCols(3);
m_Spread1.ScrollBars(ScrollBarsVertical);
// Define gray area background color of the control
m_Spread1.GrayAreaBackColor(0x00FFFFFF);
// Define cells as type number;
m_Spread1.CellType(CellTypeNumber);
m_Spread1.TypeSpin(TRUE);
m_Spread1.TypeSpinWrap(FALSE);
m_Spread1.TypeSpinInc("1.00");
m_Spread1.TypeNumberDecPlaces(0);
// define the spin increment
m_Spread1.Col(1);
m_Spread1.Row(-1);
m_Spread1.TypeSpinInc("1.00");
m_Spread1.Col(2);
m_Spread1.Row(-1);
m_Spread1.TypeSpinInc("2.00");
m_Spread1.Col(3);
m_Spread1.Row(-1);
m_Spread1.TypeSpinInc("3.00");
// Set the title of the column headers
m_Spread1.Row(SPREADHEADER);
m_Spread1.Col(1);
m_Spread1.Text("Single Births");
m_Spread1.Col(2);
m_Spread1.Text("Twins");
m_Spread1.Col(3);
m_Spread1.Text("Triplets");
// Set the title of the row headers
m_Spread1.Col(SPREADHEADER);
m_Spread1.Row(1);
m_Spread1.Text("1997";)
m_Spread1.Row(2);
m_Spread1.Text("1998");
m_Spread1.Row(3);
m_Spread1.Text("1999");
m_Spread1.Row(4);
m_Spread1.Text("2000");
m_Spread1.Row(5);
m_Spread1.Text("2001");
m_Spread1.Row(6);
m_Spread1.Text("2002");

Visual Basic

' Set the number of columns in the sheet
fpSpread1.MaxCols = 3
fpSpread1.ScrollBars = ScrollBarsVertical
' Define gray area background color of the control
fpSpread1.GrayAreaBackColor = RGB(255, 255, 255)
' Define cells as type number
fpSpread1.CellType = CellTypeNumber
fpSpread1.TypeSpin = True
fpSpread1.TypeSpinWrap = False
fpSpread1.TypeNumberDecPlaces = 0
' Define the spin increment
fpSpread1.Col = 1
fpSpread1.Row = -1
fpSpread1.TypeSpinInc = "1.00"
fpSpread1.Col = 2
fpSpread1.Row = -1
fpSpread1.TypeSpinInc = "2.00"
fpSpread1.Col = 3
fpSpread1.Row = -1
fpSpread1.TypeSpinInc = "3.00"
' Set the title of the column headers
fpSpread1.Row = SpreadHeader
fpSpread1.Col = 1
fpSpread1.Text = "Single Births"
fpSpread1.Col = 2
fpSpread1.Text = "Twins"
fpSpread1.Col = 3
fpSpread1.Text = "Triplets"
' Set the title of the row headers
fpSpread1.Col = SpreadHeader
fpSpread1.Row = 1
fpSpread1.Text = "1997"
fpSpread1.Row = 2
fpSpread1.Text = "1998"
fpSpread1.Row = 3
fpSpread1.Text = "1999"
fpSpread1.Row = 4
fpSpread1.Text = "2000"
fpSpread1.Row = 5
fpSpread1.Text = "2001"
fpSpread1.Row = 6
fpSpread1.Text = "2002"

Copyright © GrapeCity, inc. All rights reserved.