Spread 8.0 Documentation
SSImportExcelSheet Function
Support Options
DLL Reference > DLL Functions > SSImportExcelSheet Function

Glossary Item Box

SSImportExcelSheet Function


See Also    ActiveX

Applies To

fpSpread DLL control

Description

Imports the specified sheet from an Excel-formatted file.

Syntax

C

BOOL SSImportExcelSheet(HWND hWnd, short nWorkbookHandle, short nSheetIndex, LPCTSTR lpszSheetName);

C++

BOOL TSpread::ImportExcelSheet( short nWorkbookHandle, short nSheetIndex, LPCTSTR lpszSheetName);

Parameters

The following parameters are available:

Parameter Description
hWnd Window handle of the fpSpread control
nWorkbookHandle Handle of the workbook containing the sheet you want to import, returned from the SSGetExcelSheetList function
nSheetIndex Set to the zero-based sheet index or set to –1 to specify the sheet name using the lpszSheetName parameter
lpszSheetName Set to the sheet name if you have set the sSheetIndex parameter to –1. Set to NULL if you have specified an index value using the nSheetIndex parameter.

Remarks

Use this function to import a sheet from an Excel-formatted file. Spread can only import from Excel-formatted files in BIFF8 format, which is the format used by Excel 97, Excel 2000, and Excel 2002.

Call the SSGetExcelSheetList function before you call the SSImportExcelSheet function. This function is called for the current sheet setting unless you first call the SSSetSheet function to specify the sheet with which you want to work.

To find the number or name of the sheet you want to import, call the SSGetExcelSheetList function to return the handle to the workbook and a list of the sheet names available in the workbook. Then, provide either the zero-based sheet list index or sheet name using either the nSheetIndex or lpszSheetName parameter.

The workbook handle returned by the SSGetExcelSheetList function is an identifier that represents an Excel workbook that was opened by the Spread import process. The handle is global: if your project contains other fpSpread controls, or multiple projects are running that contain fpSpread controls, any of the fpSpread controls can use the workbook handle created by the import process. For more information about the workbook handle, see the SSGetExcelSheetList function topic.

When you call the SSGetExcelSheetList function, you can specify to create a log file using the lpszLogFileName parameter. When the SSGetExcelSheetList function is called, the conversion process creates a log file with information about the conversion of the Excel-formatted file. When you subsequently call the SSImportExcelSheet function, additional conversion information is appended to the log file about the sheet you are importing. If you call the SSImportExcelSheet function again for another sheet in the file, the information about that sheet is appended to the log file.

Caution: Loading an Excel file into the control deletes the data currently in the control. The loaded file overwrites existing data. Also, if your sheet had more columns and rows than the loaded sheet, those columns and rows are removed. For example, if your sheet had 100 columns and rows of data, and the loaded sheet has 50 columns and rows of data, once the new sheet is loaded, the sheet only has 50 columns and rows.

For instructions and more information about importing Excel-formatted files, see Loading an Excel-Formatted File and Excel-Formatted File Import/Export (online PDF manual). Excel-Formatted File Import/Export includes a list and description of the log message numbers.

Return Value

TRUE if the function completes successfully; FALSE otherwise.

See Also

Loading an Excel-Formatted File
Excel-Formatted File Import/Export (online PDF manual)

SSExportToExcel, SSGetExcelSheetList, SSIsExcelFile, SSSetSheet, SSSaveExcel2007Filefunctions

ActiveX Correspondence

ImportExcelSheet method

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