PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
xlsCurrentWorksheet (Function)
In french: xlsFeuilleEnCours
Used to find out and modify the current worksheet in an XLS file.
Notes:
  • 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
Subscript of the current worksheet. This value is included between 1 and xlsNbWorksheet.
<XLS document>: xlsDocument variable
Name of xlsDocument variable to use.

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 xlsDocument variable to use.
<Worksheet number>: Integer
Subscript 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(<Identifier of XLS file>)
<Result>: Integer
Subscript of the current worksheet. This value is included between 1 and xlsNbWorksheet.
<Identifier of XLS file>: Integer
Identifier of XLS file to handle, returned by xlsOpen.

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

<Result> = xlsCurrentWorksheet(<Identifier of XLS file> , <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).
<Identifier of XLS file>: Integer
Identifier of XLS file to handle, returned by xlsOpen.
<Worksheet number>: Integer
Subscript of the new worksheet. This value is included between 1 and xlsNbWorksheet.
Component : wd240xls.dll
Minimum version required
  • Version 11
This page is also available for…
Comments
Click [Add] to post a comment