)
We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

What is the way to locate cells that contain formula/links/strings/Number using XLSIO?

Platform: WinForms |
Control: XlsIO |
Published Date: April 30, 2011 |
Last Revised Date: December 4, 2019

XlsIO has the following API''s to locate the cells that contain the formula, links,strings and Number.

  • HasFormula: Returns the cell that contains formula.
  • HasStyle: Returns the cell that contains Hyperlink.
  • HasString: Returns the cell that has the string value.
  • HasNumber: Returns the cell that has the numeric value.

C#

for (int i = 0; i < sheet.UsedRange.Rows.Length; i++)
{
 for (int j = 0; j < sheet.UsedRange.Columns.Length; j++)
 {
  IRange cell = sheet.Range[i + 1, j + 1];
  if (cell.HasFormula == true)
  {
   MessageBox.Show(cell.AddressLocal + "" + cell.Formula.ToString());
  }
 }
}

 

VB

For i As Integer = 0 To sheet.UsedRange.Rows.Length - 1
 For j As Integer = 0 To sheet.UsedRange.Columns.Length - 1
            Dim cell As IRange = sheet.Range(i + 1, j + 1)
                      If cell.HasFormula = True Then
                         MessageBox.Show(cell.AddressLocal + cell.Formula.ToString())
                     End If
 Next j
Next i

 

Here is the sample for your reference:

Access_Cell_Range.zip

 

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon