Search method in Excel case sensitive
dakhama-mehdi opened this issue · 4 comments
hello,
I use the search method as shown below in the script, I noticed that the search function respects case, if the searched word is in lower case like Password instead of PASSWORD it returns false to me, so on Is there a way to add a case option or take this into account because with the dsk dll this does not cause a problem I think the function is in the closed.dll module I have not managed to find her.
Thank you so much
Import-Module PSWriteOffice
$excel = Get-OfficeExcel -FilePath $filepath
[string]$findtext = $excel.Search($pattern)
Hi, thanks you for reply,
I just installed a clean server, I installed only the pswriteoffice module and I can call the search method with the contents of the excel file I think that get-office retrieves all the meta of the file, but according to my research the serach comes from the closed dll. try loading an xlsx file like I did and you will find the search method, I did this on three servers without the module this is not possible.
If you look at:
PS C:\Support\GitHub\PSWriteOffice\Sources\PSWriteOffice> $Excel.Search
OverloadDefinitions
-------------------
System.Collections.Generic.IEnumerable[ClosedXML.Excel.IXLCell] Search(string searchText, System.Globalization.CompareOptions compareOptions = System.Globalization.CompareOptions.Ordinal, bool searchFormulae = False)
System.Collections.Generic.IEnumerable[ClosedXML.Excel.IXLCell] IXLWorkbook.Search(string searchText, System.Globalization.CompareOptions compareOptions = System.Globalization.CompareOptions.Ordinal, bool searchFormulae = False)
you can see you can use compare options
$Excel.Search("test", [System.Globalization.CompareOptions]::IgnoreCase, $false)
There are many other compare options to choose from
Thank you a lot, i havent see IgnoreCase in the option.