Spread 8.0 Documentation
DLL
Support Options

Glossary Item Box

DLL


To load an existing spreadsheet from an Excel-formatted file

  1. Call the SSIsExcelFile function to determine if the file is in the Excel BIFF8 format. Call the SSIsExcel2007File function to determine if the file is in the xlsx format.
    If the file is an Excel file in BIFF8 format, continue to step 2. If the file is not an Excel file in BIFF8 or xlsx format, Spread cannot import the file. If the file is in the xlsx file format, call the SSOpenExcel2007File function.
  2. Call the SSImportExcelBook function or call the SSGetExcelSheetList function and set the parameters as follows to return the number of worksheets in the Excel-formatted file:
    1. Set the lpszFileName parameter to the path and file name of the Excel-formatted spreadsheet.
    2. Set the lpszLogFileName parameter to the path and filename of the log file that records the manner in which Spread handles the import of Excel features, including cell types and other settings. If you do not want to generate a log file, set the lpszLogFileName parameter to NULL.
    3. Set the Replace parameter to TRUE to read the entire Excel file.
    The SSGetExcelSheetList function returns the number of worksheets in the lpnListCount parameter, the global handle in the lpnWorkbookHandle parameter, and a buffer of NULL-terminated strings in the lpghList parameter.

    Note: Set the Replace parameter to TRUE in any case in which you want to force a Refresh of the information read from the Excel-formatted file. For example, you would want to force a Refresh any time you are importing a different Excel-formatted file to overwrite the earlier data read when importing the previous Excel-formatted file or if the Excel file has changed.

  3. If you did not use the SSImportExcelBook function, call the SSImportExcelSheet function and set the function parameters as follows.
    1. If you want to use a Worksheet number,
      1. Set the nSheetIndex parameter to the Worksheet number.
        The Worksheet number is zero-based and is an index in the lpghList parameter returned by the SSGetExcelSheetList function in step 2.
      2. Set the lpszSheetName to NULL.
    2. If you want to use a Worksheet name,
      1. Set the lpszSheetName parameter to the Worksheet name.
        The Worksheet name is a name from the lpghList parameter returned by the SSGetExcelSheetList function in step 2.
      2. Set the nSheetIndex parameter to –1.
  4. Free the memory allocated by the SSGetExcelSheetList for the lpghList parameter. For example:

GLOBALHANDLE gh;
SSGetExcelSheetList( . . . , &ghList . . . )
GlobalFree(ghList);

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