//行列坐标转换为字符串 BOOL Conv_Row_Col_to_Str(CString &str, long row, long col) { if(row < 1 || row > 65535 || col < 1 || col > 256) return(false); col--; #define DECIMAL26_COL ('Z'-'A'+1) long r_Col[] = { col/DECIMAL26_COL, col%DECIMAL26_COL}; CString colStr; if(r_Col[0] > 0) colStr += (TCHAR)(_T('A')+r_Col[0]-1); colStr += (TCHAR)(_T('A') + r_Col[1]); str.Format( _T("%s%ld"), colStr, row); return(true); } //字符串转化为行列坐标 BOOL Conv_Str_to_Row_Col(LPCTSTR in_str, long *row, long *col) { long TmpRow=0,TmpCol=0; CString str = in_str; if(str.GetLength() <= 0) return(false); str.MakeUpper(); INT index=0; while(index < str.GetLength()) { TCHAR tchar = str.GetAt(index); if(tchar >= 'A' && tchar <= 'Z') { TmpCol *= 'Z' - 'A' + 1; TmpCol += tchar - 'A'; } else if(tchar >= '0' && tchar <= '9') { TmpRow *= '9'- '0' + 1; TmpRow += tchar - '0'; } else { break; } index++; } TmpCol ++; if(row) *row = TmpRow; if(col) *col = TmpCol; return(true); }