- Type of data entered in a column: taking the empty columns into account
- Managing errors
xlsColumnType (Function) In french: xlsTypeColonne
Not available
Returns the type of data entered in a column of an XLS file. The result depends on the opening mode of XLS file: - In multi-sheet mode, the column used is found on the worksheet selected by xlsCurrentWorksheet.
- In compatible mode, the column used is always found on the first worksheet of the workbook.
Remark: The type of data entered in a column of an XLS file is returned if: - The XLS file exists.
- The XLS file is opened.
// Open an XLS file XLSFileID = xlsOpen("C:\MyDirectory\File.XLS") IF XLSFileID <> -1 THEN // Type of data entered ResColumnTitle = xlsColumnType(XLSFileID, 4) SWITCH ResColumnTitle CASE xlsTypeString: Info("String data") CASE xlsTypeDate: Info("Date data") CASE xlsTypeDouble: Info("Numeric data") CASE xlsTypeTime: Info("Time data") CASE xlsTypeDateTime: Info("DateTime data") CASE xlsTypeDuration: Info("Duration data") CASE xlsTypeCurrency: Info("Currency data") END ... END
Syntax
Syntax that is using the xlsDocument type Hide the details
<Result> = xlsColumnType(<XLS document> , <Column number> [, <Empty columns>])
<Result>: Integer constant Type of data entered in the specified column: | | xlsTypeCurrency | "Currency" column | xlsTypeDate | "Date" column | xlsTypeDateTime | "DateTime" column | xlsTypeDouble | "Numeric" column | xlsTypeDuration | "Duration" column | xlsTypeEmpty | Column entirely empty if <Empty columns> = False | xlsTypeError | If an error occurs. To get more details on the error, use xlsMsgError or ErrorInfo with the errMessage constant. | xlsTypeString | "Character string" column or column containing different types of data | xlsTypeTime | "Time" column |
<XLS document>: xlsDocument variable Name of the xlsDocument variable corresponding to the XLS file to use. <Column number>: Integer Number of the column to read. <Empty columns>: Optional boolean Mode for taking the empty columns into account: | | False | The columns that are entirely empty are taken into account | True (by default) | The columns that are entirely empty are ignored |
Syntax kept for backward compatibility with version 12 Hide the details
<Result> = xlsColumnType(<XLS file identifier> , <Column number> [, <Empty columns>])
<Result>: Integer constant Type of data entered in the specified column: | | xlsTypeCurrency | "Currency" column | xlsTypeDate | "Date" column | xlsTypeDateTime | "DateTime" column | xlsTypeDouble | "Numeric" column | xlsTypeDuration | "Duration" column | xlsTypeEmpty | Column entirely empty if <Empty columns> = False | xlsTypeError | If an error occurs. To get more details on the error, use xlsMsgError or ErrorInfo with the errMessage constant. | xlsTypeString | "Character string" column or column containing different types of data | xlsTypeTime | "Time" column |
<XLS file identifier>: Integer Identifier of the XLS file to handle, returned by xlsOpen. <Column number>: Integer Number of the column to read. <Empty columns>: Optional boolean Mode for taking the empty columns into account: | | False | The columns that are entirely empty are taken into account | True (by default) | The columns that are entirely empty are ignored |
Remarks Type of data entered in a column: taking the empty columns into account The empty columns can be taken into account or not. For example:
xlsColumnType(XLSFileID, 2, True) // Returns xlsTypeString xlsColumnType(XLSFileID, 2, False) // Returns xlsTypeEmpty
Managing errors xlsColumnType throws an error in the following cases: - The specified column does not exist (negative column for example).
- The specified XLS file is not opened.
This page is also available for…
|
|
|
|