Hi Khanh Dang,
Greetings from Syncfusion.
You can get all the values in a named range only with its name, ant it is not necessary to define firstrow, firstcolumn and so on. Kindly look into the following code snippet which may fulfill your requirement.
Code snippet:
|
Using excelEngine As ExcelEngine = New ExcelEngine()
Dim application As IApplication = excelEngine.Excel
application.DefaultVersion = ExcelVersion.Excel2013
Dim workbook As IWorkbook = application.Workbooks.Open("Input.xlsx")
Dim worksheet As IWorksheet = workbook.Worksheets(0)
'Access a range by using defined name
worksheet.Names.Add("mynameRange", worksheet.Range("C1:F5"))
Dim namedRange As IRange = worksheet.Range("mynameRange")
For Each range As IRange In namedRange
Console.WriteLine(range.Text)
Next
Console.ReadKey()
End Using |
We have also prepared a working sample with the above code, which can be downloaded from the following link.
Kindly let us know if this helps.
Regards,
Shamini