Spread 8.0 Documentation
Example
Support Options

Glossary Item Box

Example


The following example lets the user display multiple pages of a spreadsheet at one time, or individual pages at 80%.

C++

// Connect fpSpread control to fpSpreadPreview control
m_Preview.SetHWndSpread(m_Spread.GetHWnd());
// Hide Spread control
m_Spread.ShowWindow(SW_HIDE);
// Provide content for text box
SetDlgItemInt(IDC_TEXT1, m_Preview.GetPageCurrent());
// Display multiple pages in fpSpreadPreview
m_Preview.SetPageViewType(PageViewTypeMultiplePages);
// Display three pages across and two pages down
m_Preview.SetPageMultiCntH(3);
m_Preview.SetPageMultiCntV(2);

void CmyWnd::OnCommand1()
{
    // View current page at 80 percent
    m_Preview.SetPageViewType(PageViewTypePercentage);
    m_Preview.SetPageViewPercentage(80);
}

void CmyWnd::OnCommand2()
{
    // Zoom back out to multiple page view
    m_Preview.SetZoomState(ZoomStateOut);
}

Visual Basic

Sub Form_Load()
    ' Connect fpSpreadPreview control to fpSpread control
    fpSpreadPreview1.hWndSpread = fpSpread1.hWnd
    ' Hide Spread control
    fpSpread1.Visible = False
    ' Provide captions for command buttons
    Command1.Caption = "View at 80%"
    Command2.Caption = "View multiple pages"
    ' Provide label and content for text box
    Label1.Caption = "Page"
    Text1.Text = fpSpreadPreview1.PageCurrent
    ' Display multiple pages in fpSpreadPreview
    fpSpreadPreview1.PageViewType = PageViewTypeMultiplePages
    ' Display three pages across and two pages down
    fpSpreadPreview1.PageMultiCntH = 3
    fpSpreadPreview1.PageMultiCntV = 2
End Sub

Sub Command1_Click()
    ' View current page at 80 percent
    fpSpreadPreview1.PageViewType = PageViewTypePercentage
    fpSpreadPreview1.PageViewPercentage = 80
End Sub

Sub Command2_Click()
    ' Zoom back out to multiple page view
    fpSpreadPreview1.ZoomState = ZoomStateOut
End Sub

Sub fpSpreadPreview1_PageChange(ByVal Page As Long)
    ' Display current page number to user when page changes
    Text1.Text = Page
End Sub

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