ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / XLS file functions
  • Example 1: Type of data entered in a column
  • Example 2: Type of data entered in a column (with management of columns entirely empty)
xlsColumnType (Example)
Example 1: Type of data entered in a column
The following code enables you to find out the type of data entered in a column of an XLS file. The columns that are entirely empty are not taken into account (True). This file was opened by xlsOpen.
// Declare the variables
XLSFileID is int
ResColumnType is int
// Open an XLS file
XLSFileID = xlsOpen("C:\MyDirectories\MyFiles\File.XLS")
IF XLSFileID <> -1 THEN
// Type of data entered in the column
ResColumnType = xlsColumnType(XLSFileID, 3, True)
// Display the type of data entered in the column
SWITCH ResColumnType
CASE xlsTypeString: Info("This is a string column")
CASE xlsTypeDouble: Info("This is a numeric column")
CASE xlsTypeDate: Info("This is a date column")
CASE xlsTypeTime: Info("This is a time column")
CASE xlsTypeDateTime: Info("This is a DateTime column")
CASE xlsTypeDuration: Info("This is a Duration column")
CASE xlsTypeCurrency: Info("This is a Currency column")
CASE xlsTypeError: Error(xlsMsgError(XLSFileID))
END
ELSE
// Display an error message if the opening was not performed
Error(xlsMsgError(XLSFileID))
END
// Close the XLS file
xlsClose(XLSFileID)
Example 2: Type of data entered in a column (with management of columns entirely empty)
The following code enables you to find out the type of data entered in a column of an XLS file. The columns that are entirely empty are taken into account (False). This file was opened by xlsOpen.
// Declare the variables
XLSFileID is int
ResColumnType is int
// Open an XLS file
XLSFileID = xlsOpen("C:\MyDirectories\MyFiles\File.XLS")
IF XLSFileID <> -1 THEN
// Type of data entered in the column
ResColumnType = xlsColumnType(XLSFileID, 3, False)
// Display the type of data entered in the column
SWITCH ResColumnType
CASE xlsTypeString: Info("This is a string column")
CASE xlsTypeDouble: Info("This is a numeric column")
CASE xlsTypeDate: Info("This is a date column")
CASE xlsTypeTime: Info("This is a time column")
CASE xlsTypeDateTime: Info("This is a DateTime column")
CASE xlsTypeDuration: Info("This is a Duration column")
CASE xlsTypeCurrency: Info("This is a Currency column")
CASE xlsTypeEmpty: Info("The column is entirely empty")
CASE xlsTypeError: Error(xlsMsgError(XLSFileID))
END
ELSE
  // Display an error message if the opening was not performed
Error(xlsMsgError(XLSFileID))
END
// Close the XLS file
xlsClose(XLSFileID)
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help