Aspose.Cells怎么使用列和行索引得到单元格名字

作者:控件中国网   出处:控件中国网   2015-07-22 09:49:31   阅读:22

在处理Excel时,有时会需要得到单元格的名字,Aspose Cells为开发人员提供了 CellsHelper.CellIndexToName方法用于得到某个单元格的名字,在使用该方法时需要注意Aspose Cells对单元格的索引都是从0开始的,下面的代码阐释了如何得到单元格名字:

C#

string cellname = CellsHelper.CellIndexToName(0, 0);
Debug.WriteLine("Cell Name at [0, 0]: " + cellname);

cellname = CellsHelper.CellIndexToName(4, 0);
Debug.WriteLine("Cell Name at [4, 0]: " + cellname);

cellname = CellsHelper.CellIndexToName(0, 4);
Debug.WriteLine("Cell Name at [0, 4]: " + cellname);

cellname = CellsHelper.CellIndexToName(2, 2);
Debug.WriteLine("Cell Name at [2, 2]: " + cellname);

VB.NET

Dim cellname As String = CellsHelper.CellIndexToName(0, 0)
Debug.WriteLine("Cell Name at [0, 0]: " + cellname)

cellname = CellsHelper.CellIndexToName(4, 0)
Debug.WriteLine("Cell Name at [4, 0]: " + cellname)

cellname = CellsHelper.CellIndexToName(0, 4)
Debug.WriteLine("Cell Name at [0, 4]: " + cellname)

cellname = CellsHelper.CellIndexToName(2, 2)
Debug.WriteLine("Cell Name at [2, 2]: " + cellname)

Copyright© 2006-2015 ComponentCN.com all rights reserved.重庆磐岩科技有限公司(控件中国网) 版权所有 渝ICP备12000264号 法律顾问:元炳律师事务所
客服软件
live chat