PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • Number of columns in an XLS file
xlsNbColumn (Example)
Number of columns in an XLS file
The following code returns the number of columns in 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
ResNbColumns is int
// Open an XLS file
XLSFileID = xlsOpen("C:\MyDirectories\MyFiles\File.XLS")
IF XLSFileID <> -1 ALORS
// Number of columns
ResNbColumns = xlsNbColumn(XLSFileID, True)
IF ResNbColumns <> -1 THEN
 IF ResNbColumns = 0 THEN
 // There is no column
 Info("The XLS file contains no column")
 ELSE
 // Display the number of columns
 Info("The file contains: " + ResNbColumns + ...
"columns")
 END
ELSE
// Display the error message
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