Spread 8.0 Documentation
Example
Support Options

Glossary Item Box

Example


The following example illustrates a sheet (bound to BIBLIO.MDB provided with Visual Basic for the Visual Basic example) that automatically merges data in cells in the specified columns and rows if the data is identical.

C++

void CmyWnd::MyFunc()
{
    // Merge columns if selected
    if (IsDlgButtonChecked(IDC_RADIO1) != 0) {
        m_Spread1.SetCol(m_ColMerge);
        m_Spread1.SetColMerge(MergeAlways);
    }
    // Otherwise merge rows
    if (IsDlgButtonChecked(IDC_RADIO2) != 0) {
        m_Spread1.SetRow(m_RowMerge);
        m_Spread1.SetRowMerge(MergeAlways);
    }

}

Visual Basic

Private Sub Command1_Click()
    ' Merge columns if selected
    If Check1.Value = 1 Then
        fpSpread1.Col = Text1.Text
        fpSpread1.ColMerge = MergeAlways
    End If
    ' Otherwise merge rows
    If Check2.Value = 1 Then
        fpSpread1.Row = Text2.Text
        fpSpread1.RowMerge = MergeAlways
    End If
End Sub

Private Sub Form_Load()
    ' Set up merge input
    Check1.Caption = "Merge cells in column"
    Check2.Caption = "Merge cells in row"
    Text1.Text = "1"
    Text2.Text = "1"
    Command1.Caption = "Merge"
End Sub

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