Spread 8.0 Documentation
Example
Support Options

Glossary Item Box

Example


The following example creates a workbook with two sheets, and puts data in both sheets. The user can click a button to save the workbook to an Excel-formatted file.

C++

BOOL CAboutDlg::OnInitDialog()
{
    CDialog::OnInitDialog();
    //Set number of sheets
    m_Spread.SetSheetCount(2);
    //Add data
    m_Spread.SetSheet(1);
    m_Spread.SetCol(1);
    m_Spread.SetRow(1);
    m_Spread.SetText("testing");
    m_Spread.SetBackColor(0x0000FFFF);
    m_Spread.SetSheet(2);
    m_Spread.SetCol(1);
    m_Spread.SetRow(1);
    m_Spread.SetText("Test 2");
    m_Spread.SetBackColor(0x00008000);
}

void CAboutDlg::OnClickFpbtn1()
{
    //Export to file
    m_Spread.ExportExcelBook("c:\\test.xls", "c:\\test.log");
}

Visual Basic

Private Sub Form_Load()
    ' Set number of sheets
    fpSpread1.SheetCount = 2
    ' Add data
    fpSpread1.Sheet = 1
    fpSpread1.Col = 1
    fpSpread1.Row = 1
    fpSpread1.Text = "testing"
    fpSpread1.BackColor = vbBlue
    fpSpread1.Sheet = 2
    fpSpread1.Col = 1
    fpSpread1.Row = 1
    fpSpread1.Text = "Test 2"
    fpSpread1.BackColor = vbYellow
End Sub

Private Sub Command1_Click()
    ' Save to xls file type
    fpSpread1.ExportExcelBook App.Path & "\Test.xls", App.Path & "\Test.log"
End Sub

Copyright © GrapeCity, inc. All rights reserved.