public virtual int TableSplit(string bookmark) { try { List <CellInfo> cellList = new List <CellInfo>(); int pageIndex = 0; Range tableRange = GetBookmarkRank(_currentWord, bookmark); Table table = tableRange.Tables[1]; Cells cells = table.Range.Cells; foreach (Cell cell in cells) { Range r = cell.Range; int rowNumber = (int)r.Information[WdInformation.wdStartOfRangeRowNumber]; int columnNumber = (int)r.Information[WdInformation.wdStartOfRangeColumnNumber]; int pageNumber = (int)r.Information[WdInformation.wdActiveEndPageNumber]; cellList.Add(new CellInfo(r.Text, rowNumber, columnNumber, pageNumber, cell)); if (r.Text.Equals("\r\a") && !r.Text.Contains("$$")) { continue; } r.Select(); if (_wordApp.Selection.Bookmarks.Exists("photo")) { break; } if (pageNumber >= 6 && pageNumber != pageIndex) { //判断第一列最后一个单元格 的高度 CellInfo cellInfo = cellList.LastOrDefault(p => p.ColumnNumber == 1); if (cellInfo != null) { Cell firstLastCell = table.Cell(cellInfo.RowNumber, cellInfo.ColumnNumber); if (HandleFirstColumnCellAddRow(firstLastCell, pageNumber, table, cellList)) { pageIndex = pageNumber; continue; } } r.Select(); _wordApp.Selection.SplitTable(); List <Cell> cellNextList = new List <Cell>(); for (int j = 1; j <= 11; j++) { Cell cellNext = TableContinueContent(table, j, cellList, pageNumber); if (cellNext != null) { cellNextList.Add(cellNext); } } //处理单项结论 HandleConclusion(table, cellList, cellNextList); _wordApp.Selection.Delete(WdUnits.wdCharacter, 1); pageIndex = pageNumber; } } //替换字符 Dictionary <int, Dictionary <string, string> > replaceDic = new Dictionary <int, Dictionary <string, string> >(); Dictionary <string, string> valuePairs = new Dictionary <string, string>(); valuePairs.Add("$$", ""); //报告编号 replaceDic.Add(1, valuePairs); //替换全部内容 ReplaceWritten(replaceDic); return(1); } catch (Exception ex) { _needWrite = false; Dispose(); throw new Exception(string.Format("错误信息:{0}.{1}", ex.StackTrace.ToString(), ex.Message)); } }