mirror of
https://github.com/dfinke/ImportExcel.git
synced 2025-12-06 00:23:20 +00:00
Resolve worksheet argumentcompleter Fixes:#1590
This commit is contained in:
@@ -67,9 +67,8 @@ function WorksheetArgumentCompleter {
|
|||||||
param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter)
|
param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter)
|
||||||
$xlPath = $fakeBoundParameter['Path']
|
$xlPath = $fakeBoundParameter['Path']
|
||||||
if (Test-Path -Path $xlPath) {
|
if (Test-Path -Path $xlPath) {
|
||||||
$xlpkg = Open-ExcelPackage -ReadOnly -Path $xlPath
|
$xlSheet = Get-ExcelSheetInfo -Path $xlPath
|
||||||
$WorksheetNames = $xlPkg.Workbook.Worksheets.Name
|
$WorksheetNames = $xlSheet.Name
|
||||||
Close-ExcelPackage -nosave -ExcelPackage $xlpkg
|
|
||||||
$WorksheetNames.where( { $_ -like "*$wordToComplete*" }) | foreach-object {
|
$WorksheetNames.where( { $_ -like "*$wordToComplete*" }) | foreach-object {
|
||||||
New-Object -TypeName System.Management.Automation.CompletionResult -ArgumentList "'$_'",
|
New-Object -TypeName System.Management.Automation.CompletionResult -ArgumentList "'$_'",
|
||||||
$_ , ([System.Management.Automation.CompletionResultType]::ParameterValue) , $_
|
$_ , ([System.Management.Automation.CompletionResultType]::ParameterValue) , $_
|
||||||
|
|||||||
Reference in New Issue
Block a user