/// <summary> /// gets the rowIndex and colIndex of the chart according to the name of the cell /// </summary> /// <param name="cellName"></param> /// <param name="tableData"></param> /// <returns></returns> public CellPos GetCellPos(string cellName,Table tableData) { int i = 0; int columnIndex = 0; int rowIndex = 0; char[] columnStr = new char [2]; string rowStr = null; foreach(char c in cellName) { if (c>='A'&&c<='Z') { columnStr[i]=c; i++; } } if (i==1) columnIndex = columnStr[0]-'A'; if (i==2) columnIndex=(columnStr[0]-'A')*26 +(columnStr[1]-'A'); columnIndex = columnIndex+1; rowStr = cellName.Substring (i); rowIndex = Int32.Parse (rowStr); Cell cell = null; if (rowIndex<=tableData.Rows .Count ) { Row row = tableData.Rows [rowIndex-1]; if (columnIndex<=row.Cells.Count ) { cell= tableData.Rows [rowIndex-1].Cells [columnIndex-1]; } } if (cell==null) { cell = new Cell(_document); tableData.InsertCellAt (rowIndex,columnIndex,cell); } CellPos pos = new CellPos (); pos.cell =cell; pos.columnIndex = columnIndex; pos.rowIndex = rowIndex; return pos; }