Spread 8.0 Documentation
Example
Support Options

Glossary Item Box

Example


The following example lets the user choose to export the sheet or a selected range in the sheet to an HTML file. Message boxes report whether the export was successful.

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

C++

void OnCommand1()
{
    bool x;
    // Export whole file and set result to x
    x = m_Spread1.ExportToHTML("C:\\Samples\\FILE.HTML", False, "");
    // Display result to user based on true/false value
    // of x
    if (x)
        MessageBox("Export Complete");
    else
        MessageBox("Export did not succeed.");
}

void OnCommand2()
{
    bool x;
    // Export selected range of file and set result to x
    x = m_Spread1.ExportRangeToHTML( m_Spread1.GetSelBlockCol(), m_Spread1.GetSelBlockRow(), m_Spread1.GetSelBlockCol2(), m_Spread1.GetSelBlockRow2(), "C:\\Samples\\RFILE.HTML", False, "");
   



// Display result to user based on true/false value of x
    if (x)
        MessageBox ("Export Complete");
    else
        MessageBox ("Export did not succeed.");
}

Visual Basic

Sub Form_Load()
    ' Set up buttons
    Command1.Caption = "Export Sheet"
    Command2.Caption = "Export Selected Range"
End Sub

Sub Command1_Click()
    Dim x As Boolean
    ' Export whole file and set result to x
    x = fpSpread1.ExportToHTML("C:\Samples\FILE.HTML", False, "")
    ' Display result to user based on T/F value of x
    If x = True Then
        MsgBox "Export Complete", , "Result"
    Else
        MsgBox "Export did not succeed.", , "Result"
    End If
End Sub

Sub Command2_Click()
    Dim x As Boolean
    ' Export selected range of file and set result to x
    x = fpSpread1.ExportRangeToHTML(fpSpread1.SelBlockCol, fpSpread1.SelBlockRow, fpSpread1.SelBlockCol2, fpSpread1.SelBlockRow2, "C:\Samples\RFILE.HTML", False, "")
    ' Display result to user based on T/F value of x
    If x = True Then
        MsgBox "Export Complete", , "Result"
    Else
        MsgBox "Export did not succeed.", , "Result"
    End If
End Sub

Copyright © GrapeCity, inc. All rights reserved.