Link Search Menu Expand Document

Search Text - VB.NET

Spreadsheet SDK sample in VB.NET demonstrating ‘Search Text’

Imports Bytescout.Spreadsheet
Imports Bytescout.Spreadsheet.BaseClasses

Class Program
	Friend Shared Sub Main(args As String())
		' Open spreadsheet from file
		Dim document As New Spreadsheet()

		' Get first worksheet
		Dim worksheet As Worksheet = document.Workbook.Worksheets(0)

		' Find cells containing "in" substring

        Dim cell As Cell = worksheet.Find("in", False, False, False) 'case insesitive, not regexp, search forward

		While cell IsNot Nothing
			' Print found cell address and value to console
			Dim address As CellAddress = cell.GetAddress()
			Dim message As String = String.Format("({0}, {1}): {2}", address.Column, address.Row, cell.ValueAsExcelDisplays)


			cell = worksheet.FindNext()
		End While


		Console.WriteLine("Press any key to continue.")
	End Sub
End Class

Download Source Code (.zip)

Return to the previous page Explore Spreadsheet SDK

Copyright © 2016 - 2021 ByteScout