We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Convert the Name object to Cell

I have name in Worksheet which refers to only one Cell, How do the get that reference in to a cell object???

I need to covert that into a Cell object .

Please respond ASAP !!!

Hi,

Yes, you may do it with ease.

Here is a sample code, I have used a simple template excel file which has a name (that referes to a single cell) in a worksheet.

Sample code:

Workbook workbook = new Workbook();
workbook.Open("f:\\test\\MyNameBook.xls");
Worksheets sheets = workbook.Worksheets;
Range[] rngs = sheets.Names["MyName"].GetRanges();
//Since it has only one range(with one cell)
Range rng = rngs[0];
Worksheet sheet = rng.Worksheet;
string sheetname = sheet.Name;
Cells cells = sheet.Cells;
Cell cell = rng[0,0];
string cellname = CellsHelper.CellIndexToName(cell.Row, cell.Column);
string cellvalue = cell.StringValue;
.............
Thank you.


Thx a lot, this resolved my Problem