ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / XLS file functions
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
xlsCurrentWorksheet (Function)
In french: xlsFeuilleEnCours
Used to find out and modify the current worksheet in an XLS file.
Remarks:
  • In multi-sheet mode, the functions used to manage the XLS files always apply to the current worksheet. When the XLS file is opened, the 1st worksheet of the workbook is the current worksheet.
  • This function has no effect in compatible mode.
Example
// Open an XLS file
FileIdentifier is int
FileIdentifier = xlsOpen("C:\My Documents\Test.XLS")
 
// Operations on the XLS file
// ...
 
// Retrieve the current worksheet
Worksheet is int = xlsCurrentWorksheet(FileIdentifier)
Info("The current worksheet is " + Worksheet)
// Open an XLS file
FileIdentifier is int = xlsOpen("C:\My Documents\Test.XLS")
 
// Position on the last worksheet of the file
NbWorksheet is int = xlsNbWorksheet(FileIdentifier)
IF xlsCurrentWorksheet(FileIdentifier, NbWorksheet) = True THEN
Info("The current worksheet was modified.")
END
cMyXLSFile is xlsDocument
sMyFile is string = "File.xls" // Full name of the file to open
 
cMyXLSFile = xlsOpen(sMyFile, xlsWrite)
IF ErrorOccurred = False THEN
Azz is int = xlsCurrentWorksheet(cMyXLSFile)
Info("Current worksheet in the Excel file: " + Azz)
// Change worksheet
IF xlsCurrentWorksheet(cMyXLSFile, 2) = True THEN
Info("The current worksheet was modified.")
// Read a cell for test
Info(xlsData(cMyXLSFile, 11, 2))
ELSE
Error("The selected file does not include a second worksheet!")
END
ELSE
Error(ErrorInfo(errFullDetails))
END
xlsClose(cMyXLSFile)
Syntax

Finding out the current worksheet Hide the details

<Result> = xlsCurrentWorksheet(<XLS document>)
<Result>: Integer
Index of the current worksheet. This value is included between 1 and xlsNbWorksheet.
<XLS document>: xlsDocument variable
Name of the xlsDocument variable to be used.

Modifying the current worksheet Hide the details

<Result> = xlsCurrentWorksheet(<XLS document> , <Worksheet number>)
<Result>: Boolean
  • True if the current worksheet was modified,
  • False otherwise (if the worksheet specified in <Worksheet number> does not exist for example).
<XLS document>: xlsDocument variable
Name of the xlsDocument variable to be used.
<Worksheet number>: Integer
Index of the new worksheet. This value is included between 1 and xlsNbWorksheet.

Finding out the current worksheet (syntax kept for backward compatibility with version 12) Hide the details

<Result> = xlsCurrentWorksheet(<XLS file identifier>)
<Result>: Integer
Index of the current worksheet. This value is included between 1 and xlsNbWorksheet.
<XLS file identifier>: Integer
Identifier of the XLS file to handle, returned by xlsOpen.

Modifying the current worksheet (syntax kept for backward compatibility with version 12) Hide the details

<Result> = xlsCurrentWorksheet(<XLS file identifier> , <Worksheet number>)
<Result>: Boolean
  • True if the current worksheet was modified,
  • False otherwise (if the worksheet specified in <Worksheet number> does not exist for example).
<XLS file identifier>: Integer
Identifier of the XLS file to handle, returned by xlsOpen.
<Worksheet number>: Integer
Index of the new worksheet. This value is included between 1 and xlsNbWorksheet.
Component: wd290xls.dll
Minimum version required
  • Version 11
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 04/06/2023

Send a report | Local help