Spread 8.0 Documentation
Example
Support Options

Glossary Item Box

Example


The following example hides the column and row headers, creates a custom row at the top of the sheet, specifies the text color for that row, freezes that row, and restricts the user from resizing that row. The custom row then acts like column headers. The sheet also forces the user to type data into one column at a time.

C++

// Hide column headers
m_Spread.SetColHeadersShow(FALSE);
// Hide row headers
m_Spread.SetRowHeadersShow(FALSE);

// Set maximum number columns
m_Spread.SetMaxCols(4);

// Ensure user types one column at a time
m_Spread.SetRestrictCols(TRUE);

// Create custom top row
// Set row not to scroll
m_Spread.SetRowsFrozen(1);
// Set row not to resize
m_Spread.SetRow(1);
m_Spread.SetCol(-1);
m_Spread.SetUserResizeRow(UserResizeOff);
// Set text color for custom row
// dark green, RGB(192, 192, 192)
m_Spread.SetForeColor(0x00008000);

// Provide text for custom row
// Specify clipping block
m_Spread.SetCol(1);
m_Spread.SetCol2(5);
m_Spread.SetRow(1);
m_Spread.SetRow2(1);
// Clip data into the sheet
m_Spread.SetClip("Date\tCheck #\tPayee\tDebit");

// Set width of specified columns
m_Spread.SetColWidth(1,5);
m_Spread.SetColWidth(3,15);

Visual Basic

' Hide column headers
fpSpread1.ColHeadersShow = False
' Hide row headers
fpSpread1.RowHeadersShow = False

' Set maximum number columns
fpSpread1.MaxCols = 4

' Ensure user types one column at a time
fpSpread1.RestrictCols = True

' Create custom top row
' Set row not to scroll
fpSpread1.RowsFrozen = 1
' Set row not to resize
fpSpread1.Row = 1
fpSpread1.Col = -1
fpSpread1.UserResizeRow = UserResizeOff
' Set text color for custom row
' dark green, RGB(192, 192, 192)
fpSpread1.ForeColor = &H00008000&

' Provide text for custom row
' Specify clipping block
fpSpread1.Col = 1
fpSpread1.Col2 = 5
fpSpread1.Row = 1
fpSpread1.Row2 = 1
' Clip data into the sheet
fpSpread1.Clip = "Date" + Chr$(9) + "Check #" + Chr$(9)+ "Payee" + Chr$(9) + "Debit"

' Set width of specified columns
fpSpread1.ColWidth(1) = 5
fpSpread1.ColWidth(3) = 15

Copyright © GrapeCity, inc. All rights reserved.