Spread 8.0 Documentation
Example
Support Options

Glossary Item Box

Example


The following example returns the last row and column that contains data and sets the scroll bars to only scroll through that data.

C++

CWnd::OnCreate()
{
    // Set the scroll bars to only scroll
    // through limited rows and columns
    m_Spread1.SetScrollBarShowMax(FALSE);
    // Add text to sheet
    m_Spread1.SetCol(1);
    m_Spread1.SetCol2(2);
    m_Spread1.SetRow(1);
    m_Spread1.SetRow2(2);
    m_Spread1.SetClip("North\tSouth\rEast\tWest");
}

CWnd::OnBtnClick()
{
    long rowcount, colcount;
    // Return the last row that contains data
    rowcount = m_Spread1.GetDataRowCnt();
    // Return the last column that contains data
    colcount = m_Spread1.GetDataColCnt();
    // Copy the data to the designated cells
    m_Spread1.CopyRange(1, 1, colcount, rowcount, colcount + 1, rowcount + 1);
}

Visual Basic

Sub Form_Load()

    ' Set the scroll bars to only scroll through limited rows and columns
    fpSpread1.ScrollBarShowMax = False

    ' Add text to sheet
    fpSpread1.Col = 1
    fpSpread1.Col2 = 2
    fpSpread1.Row = 1
    fpSpread1.Row2 = 2
    fpSpread1.Clip = "North" + Chr$(9) + "South" + Chr$(13) + "East" + Chr$(9) + "West"

End Sub

Sub Command1_Click()

    Dim rowcount, colcount As Integer

    ' Return the last row that contains data
    rowcount = fpSpread1.DataRowCnt
    ' Return the last column that contains data
    colcount = fpSpread1.DataColCnt

    ' Copy the data to the designated cells
    fpSpread1.CopyRange 1, 1, colcount, rowcount, colcount + 1, rowcount + 1

End Sub

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