Spread 本身没有提供RC到A1的转换功能,需要编码实现。
简单实现如下:
private String RCToA1(FarPoint.Win.Spread.Model.CellRange range) { Int32 startRow = range.Row + 1; Int32 endRow = range.Row + range.RowCount; String startColumn = IntToChar(range.Column); String endColumn = IntToChar(range.Column + range.ColumnCount - 1); MessageBox.Show(String.Format("{0}{1}:{2}{3}", startColumn, startRow, endColumn, endRow)); return String.Format("{0}{1}:{2}{3}", startColumn, startRow, endColumn, endRow); } private String IntToChar(Int32 num) { String str = ""; if (num == 0) { str = "A"; } else { for (Int32 i = 0; num != 0; i++) { if (num == 1) { str = "A" + str; break; } str = (Char.ConvertFromUtf32(65 - (i != 0 ? 1 : 0) + num % 26)).ToString() + str; if ((num % 26 == 0) && (num / 26 == 1)) { str = "A" + str; break; } num = num / 26; } } return str; } 复制代码