Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

Fri Jul 25, 2014 1:05 pm

Hi,

I need to locate a single cell based on a known text string that will be in it. Please could you point me in the right direction if this is possible?

Thanks,

Andy

flipperyfish
 
Posts: 6
Joined: Fri Jul 25, 2014 8:08 am

Mon Jul 28, 2014 6:43 am

Hello,

Sorry for late reply as weekend.
Thanks for your inquiry.
Following code example demonstrates how to locate a single cell based on a known text string for your reference.
Code: Select all
Workbook book = new Workbook();
book.LoadFromFile("test.xlsx");
foreach(CellRange cell in book.Worksheets[0].Cells)
            {
                if(cell.Text=="test")
                {
                    Console.WriteLine(cell.RangeAddress);
                }
            }
Console.ReadLine();

If there are any questions, welcome to get it back to us.
Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Thu Jul 31, 2014 8:47 am

Hello,

Have you tested the code provided by my colleague Gary? Has the issue been resolved?
Could you please give us some feedback if convenience?

If you have any questions, welcome to get it back to us.

Regards,
Benjamin
E-iceblue support team
User avatar

Benjamin Du
 
Posts: 82
Joined: Thu Jul 25, 2013 2:38 am

Wed Aug 06, 2014 6:14 pm

Hi,

The solution works perfectly, thanks very much.

Andy

flipperyfish
 
Posts: 6
Joined: Fri Jul 25, 2014 8:08 am

Thu Aug 07, 2014 1:41 am

Glad to hear that. If there are any questions, welcome to get it back to us.
Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Return to Spire.XLS