We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Match entire cell contents When Searching

Hi,

When using the 'Find' or 'FindString' functions is there any way of enabling the 'Match entire cell contents' flag as seen in the Excel 'Find and Replace' window?

I thought there would possibly be something within the FindOptions but I can't see anything.

In a previous forum post there is reference to a FindOptions.Setmatchtype(FindOptions.MATCH_ENTIRE) however this function is not valid. I am using version 7.0.3.2.

I checked this page in the documentation but there is no mention of it:

http://www.aspose.com/documentation/.net-components/aspose.cells-for-.net/find-or-search-data.htmlhttp://www.aspose.com/documentation/.net-components/aspose.cells-for-.net/find-or-search-data.html

Example code:

Dim dateCell As Cell
Dim dateOptions As New FindOptions()
Dim dateArea As New CellArea()

dateArea.StartColumn = startColumn
dateArea.StartRow = HeaderRow
dateArea.EndColumn = maxColumn
dateArea.EndRow = HeaderRow

dateOptions.SetRange(dateArea)
dateCell = sheet.Cells.Find("01/01/2010", Nothing, dateOptions)

Thanks,
Steve.

Hi,


Well, with new versions, you need to use FindOptions.LookAtType to set to LookAtType.EntireContent accordingly.

See the sample code below:

Dim wb As New Workbook(“e:\test\Book1.xls”)
Dim cells As Cells = wb.Worksheets(0).Cells
Dim findOptions As New FindOptions()
Dim ca As New CellArea()
ca.StartRow = 0
ca.StartColumn = 0
ca.EndRow = 17
ca.EndColumn = 13
findOptions.SetRange(ca)
findOptions.LookAtType = LookAtType.EntireContent

Dim cell1 As Aspose.Cells.Cell = cells.Find(strToFind, Nothing, findOptions)

Thankyou, works perfectly.

As a suggestion I think you should update the website's documentation to show these additional features.

Hi,


Sure, we will update the relevant document to include these options before the end of this week, you may check the document then.

Thanks