Home > Net >  Excel the cell definition names out how to use c #?
Excel the cell definition names out how to use c #?

Time:11-26

Some cells in the worksheet sheet1 defines the name, and then want to read out the name of the one of the cell in c #

Try the NAME, the TEXT of what is wrong

CodePudding user response:

Make sure you want to take the position of the cell (longitude), what is the NAME TEXT?????? I am tostring

CodePudding user response:

Reaching accept excel coordinate said the coordinates said would include name,

CodePudding user response:

Worksheet. Cells [row_1, col_1]="";

Worksheet you work this out,
Row_1 what line of work the
The which columns col_1 work

CodePudding user response:

You this is Named area, which is Named Range, did you find this attribute,

The following code is to use Spire. Xls. DLL for named region name:
 using Spire. Xls; 
using System;

The namespace GetName
{
Class Program
{
The static void Main (string [] args)
{
Workbook Workbook=new Workbook ();
Workbook. LoadFromFile (" Input. XLSX ");

//get the first global naming area (range in the name of the work sheet)
String name1=workbook. NameRanges [0]. Name;

//get the first named local area (range is the name of the worksheet)
String name2=workbook. Worksheets. [0] Names [0]. Name;
}
}
}

CodePudding user response:

If use Interop, corresponding should be workbook. Attribute Names

CodePudding user response:

refer to 6th floor Eiceblue response:
, using Interop, should be a corresponding workbook. Names attribute

Yes, I now need to traverse workbook. Names can you find the cell name, need no more simple method?

CodePudding user response:

Dim exlapp As New Excel. Application
Dim exlver As String=exlapp. Names. The Item (" ort_ver "). RefersToRange. Value

CodePudding user response:

 
Dim cellPos as string=exlapp. Names. The item (" ort_ver "). The value
Dim cellVal as string=exlapp. Names. The item (" ort_ver "). The Value
refersToRange.

CodePudding user response:

 using Excel=Microsoft. Office. Interop. Excel; 

Excel. Range allRange=Globals. ThisAddIn. Application. Get_Range (" A1 ", "B3");
Excel. The Name name2=allRange. Name;
Var name3=name2. Name;


Name3 is the name of the cell area

CodePudding user response:

Use a dictionary to record, give up the name

CodePudding user response:

In excel macro recording, and then look at the results of vba code, can be easy to half the translation for c #
  •  Tags:  
  • C#
  • Related