Spread 8.0 Documentation
Example
Support Options

Glossary Item Box

Example


The following example creates a sheet with two columns, five rows, and two column header rows. The first column contains percent values that have a maximum value of 100%, display a leading zero for values between –1.0 and 1.0, and display negative values in parentheses and red. The second column contains numeric values that have a maximum value of 1,000,000 and display a thousands separator. No decimal places are allowed.

C++

m_Spread1.MaxCols(2);
m_Spread1.MaxRows(5);
m_Spread1.GrayAreaBackColor(0x00FFFFFF);
// set column widths
m_Spread1.ColWidth(1,10);
m_Spread1.ColWidth(2,10);
m_Spread1.ColWidth(SPREADHEADER,15);
// column headers
m_Spread1.ColHeaderRows(2);
m_Spread1.Col(1);
m_Spread1.Row(SPREADHEADER);
m_Spread1.Text("2001");
m_Spread1.Row(SPREADHEADER + 1);
m_Spread1.Text("Interest rate");
m_Spread1.Col(2);
m_Spread1.Row(SPREADHEADER);
m_Spread1.Text("2001");
m_Spread1.Row(SPREADHEADER + 1);
m_Spread1.Text("Transactions");
m_Spread1.Row(SPREADHEADER);
m_Spread1.RowMerge(MergeAlways);
// row headers
m_Spread1.Col(SPREADHEADER);
m_Spread1.Row(1);
m_Spread1.Text("Scrooge's Vault");
m_Spread1.Row(2);
m_Spread1.Text("Pauper's Bank");
m_Spread1.Row(3);
m_Spread1.Text("Richie's Riches");
m_Spread1.Row(4);
m_Spread1.Text("Miser's Place");
m_Spread1.Row(5);
m_Spread1.Text("Gold's Cave");
// percent cells
m_Spread1.Col(1);
m_Spread1.Row(-1);
m_Spread1.CellType(CellTypePercent);
m_Spread1.TypePercentLeadingZero(TypeLeadingZeroYes);
m_Spread1.TypePercentNegStyle(TypePercentNegStyle8);
m_Spread1.TypePercentDecPlaces(3);
m_Spread1.TypePercentMax(100);
// display negative numbers as red
m_Spread1.TypeNegRed(TRUE);
// number cells
m_Spread1.Col(2);
m_Spread1.CellType(CellTypeNumber);
m_Spread1.TypeNumberShowSep(TRUE);
m_Spread1.TypeNumberDecPlaces(0);
m_Spread1.TypeNumberMax(1000000000);

Visual Basic

fpSpread1.MaxCols = 2
fpSpread1.MaxRows = 5
fpSpread1.GrayAreaBackColor = RGB(255, 255, 255)
' set column widths
fpSpread1.ColWidth(1) = 10
fpSpread1.ColWidth(2) = 10
fpSpread1.ColWidth(SpreadHeader) = 15
' column headers
fpSpread1.ColHeaderRows = 2
fpSpread1.Col = 1
fpSpread1.Row = SpreadHeader
fpSpread1.Text = "2001"
fpSpread1.Row = SpreadHeader + 1
fpSpread1.Text = "Interest rate"
fpSpread1.Col = 2
fpSpread1.Row = SpreadHeader
fpSpread1.Text = "2001"
fpSpread1.Row = SpreadHeader + 1
fpSpread1.Text = "Transactions"
fpSpread1.Row = SpreadHeader
fpSpread1.RowMerge = MergeAlways
' row headers
fpSpread1.Col = SpreadHeader
fpSpread1.Row = 1
fpSpread1.Text = "Scrooge's Vault"
fpSpread1.Row = 2
fpSpread1.Text = "Pauper's Bank"
fpSpread1.Row = 3
fpSpread1.Text = "Richie's Riches"
fpSpread1.Row = 4
fpSpread1.Text = "Miser's Place"
fpSpread1.Row = 5
fpSpread1.Text = "Gold's Cave"
' percent cells
fpSpread1.Col = 1
fpSpread1.Row = -1
fpSpread1.CellType = CellTypePercent
fpSpread1.TypePercentLeadingZero = TypeLeadingZeroYes
fpSpread1.TypePercentNegStyle = TypePercentNegStyle8
fpSpread1.TypePercentDecPlaces = 3
fpSpread1.TypePercentMax = 100
' display negative numbers as red
fpSpread1.TypeNegRed = True
' number cells
fpSpread1.Col = 2
fpSpread1.CellType = CellTypeNumber
fpSpread1.TypeNumberShowSep = True
fpSpread1.TypeNumberDecPlaces = 0
fpSpread1.TypeNumberMax = 1000000000

Copyright © GrapeCity, inc. All rights reserved.