Spread 8.0 Documentation
Example
Support Options

Glossary Item Box

Example


The following example marks the cells in the first row as locked, protects them from edits, and specifies a custom background and text color. The sheet displays a custom grid color and a custom gray area background color.

C++

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

// Define grid color
// black, RGB(0, 0, 0)
m_Spread.SetGridColor(0x00000000);
// Define background color of control
// dark gray, RGB(128, 128, 128)
m_Spread.SetGrayAreaBackColor(0x00808080);

// Hide row headers
m_Spread.SetDisplayRowHeaders(FALSE);

// Set width of column headers
m_Spread.SetColWidth(-1,12);

// Provide text for column headers
// Specify clipping block
m_Spread.SetCol(1);
m_Spread.SetCol2(5);
m_Spread.SetRow(0);
m_Spread.SetRow2(0);
// Clip data into the sheet
m_Spread.SetClip("Salesman\tInbound Calls\tOutbound Calls \tUnits Sold\tTotal Sales");

// Lock block of cells
// Specify the block of cells
m_Spread.SetCol(1);
m_Spread.SetCol2(1);
m_Spread.SetRow(1);
m_Spread.SetRow2(5);
m_Spread.SetBlockMode(TRUE);
// Lock cells
m_Spread.SetLock(TRUE);
// Protect the cells from being edited
m_Spread.SetProtect(TRUE);
// Turn block mode off
m_Spread.SetBlockMode(FALSE);

// Define background color of locked cells
// light gray, RGB(192, 192, 192)
m_Spread.SetLockBackColor(0x00C0C0C0);
// Define text color of locked cells
// black, RGB(0, 0, 0)
m_Spread.SetLockForeColor(0x00000000);

// Provide text for the specified rows
// Specify clipping block
m_Spread.SetCol(1);
m_Spread.SetCol2(1);
m_Spread.SetRow(1);
m_Spread.SetRow2(5);
// Clip data into the sheet
m_Spread.SetClip("Jim\nLynn\nMatt\nPaul\nSusan");

Visual Basic

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

' Define grid color
' black, RGB(0, 0, 0)
fpSpread1.GridColor = &H00000000&
' Define background color of control
' dark gray, RGB(128, 128, 128)
fpSpread1.GrayAreaBackColor = &H00808080&

' Hide row headers
fpSpread1.DisplayRowHeaders = False

' Set width of column headers
fpSpread1.ColWidth(-1) = 12

' Provide text for column headers
' Specify clipping block
fpSpread1.Col = 1
fpSpread1.Col2 = 5
fpSpread1.Row = 0
fpSpread1.Row2 = 0
' Clip data into the sheet
fpSpread1.Clip = "Salesman" + Chr$(9) + "Inbound Calls" + Chr$(9) + "Outbound Calls" + Chr$(9) + "Units Sold" + Chr$(9) + "Total Sales"

' Lock block of cells
' Specify the block of cells
fpSpread1.Col = 1
fpSpread1.Col2 = 1
fpSpread1.Row = 1
fpSpread1.Row2 = 5
fpSpread1.BlockMode = True
' Lock cells
fpSpread1.Lock = True
' Protect the cells from being edited
fpSpread1.Protect = True
' Turn block mode off
fpSpread1.BlockMode = False

' Define background color of locked cells
' light gray, RGB(192, 192, 192)
fpSpread1.LockBackColor = &H00C0C0C0&
' Define text color of locked cells
' black, RGB(0, 0, 0)
fpSpread1.LockForeColor = &H00000000&

' Provide text for the specified rows
' Specify clipping block
fpSpread1.Col = 1
fpSpread1.Col2 = 1
fpSpread1.Row = 1
fpSpread1.Row2 = 5
' Clip data into the sheet
fpSpread1.Clip = "Jim" + Chr$(13) + "Lynn" + Chr$(13) + "Matt" + Chr$(13) + "Paul" + Chr$(13) + "Susan"

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