Spread 8.0 Documentation
Example
Support Options

Glossary Item Box

Example


The following example loads an existing .SS7 file (TEAMS.SS7) with data and header text. The control is set up to optimize viewing and editing the data, including only displaying scroll bars when needed, scrolling the sheet in response to the user moving the vertical scroll bar, and allowing the user to copy and paste row headers.

To access the file used in this sample, change the path in the code to the path for your product installation's \SAMPLES\FILES directory.

C++

void CmyWnd::MyFunc()
{
    // Load file with data and header text
    m_Spread1.LoadFromFile("C:\\Samples\\Files\\teams.ss7");

    // Specify the maximum number of columns and rows
    m_Spread1.SetMaxCols(2);
    m_Spread1.SetMaxRows(29);

    // Specify the column widths
    m_Spread1.SetColWidth(0,10);
    m_Spread1.SetColWidth(-1,15);

    // Left-align the row header text
    m_Spread1.SetCol(0);
    m_Spread1.SetRow(-1);
    m_Spread1.SetTypeHAlign(TypeHAlignLeft);

    // Center-align the text in the data columns
    m_Spread1.SetBlockMode(True);
    m_Spread1.SetCol(1);
    m_Spread1.SetRow(-1);
    m_Spread1.SetCol2(2);
    m_Spread1.SetTypeHAlign(TypeHAlignCenter);
    m_Spread1.SetBlockMode(False);
    // Allow users to copy and paste row headers
    m_Spread1.SetClipboardOptions(ClipboardOptionsCopyRowHeaders | ClipboardOptionsPasteRowHeaders);

    // Do not display the scroll bars unless necessary
    m_Spread1.SetScrollBarExtMode(True);

    // Have the vertical scroll bar scroll the sheet
    m_Spread1.SetScrollBarTrack(ScrollBarTrackVertical);

}

Visual Basic

Sub Form_Load()

    ' Load file with data and header text
    fpSpread1.LoadFromFile("C:\Samples\Files\teams.ss7")

    ' Specify the maximum number of columns and rows
    fpSpread1.MaxCols = 2
    fpSpread1.MaxRows = 29

    ' Specify the column widths
    fpSpread1.ColWidth(0) = 10
    fpSpread1.ColWidth(-1) = 15

    ' Left-align the row header text
    fpSpread1.Col = 0
    fpSpread1.Row = -1
    fpSpread1.TypeHAlign = TypeHAlignLeft

    ' Center-align the text in the data columns
    fpSpread1.BlockMode = True
    fpSpread1.Col = 1
    fpSpread1.Row = -1
    fpSpread1.Col2 = 2
    fpSpread1.TypeHAlign = TypeHAlignCenter
    fpSpread1.BlockMode = False

    ' Allow users to copy and paste row headers
    fpSpread1.ClipboardOptions = ClipboardOptionsCopyRowHeaders or ClipboardOptionsPasteRowHeaders

    ' Do not display the scroll bars unless necessary
    fpSpread1.ScrollBarExtMode = True

    ' Have the vertical scroll bar scroll the sheet
    fpSpread1.ScrollBarTrack = ScrollBarTrackVertical

End Sub

Copyright © GrapeCity, inc. All rights reserved.