diff --git a/插件库/Lskj.AutoCreatWord/CreateWordUtil.cs b/插件库/Lskj.AutoCreatWord/CreateWordUtil.cs index 384e6fd..844c929 100644 --- a/插件库/Lskj.AutoCreatWord/CreateWordUtil.cs +++ b/插件库/Lskj.AutoCreatWord/CreateWordUtil.cs @@ -1417,6 +1417,31 @@ namespace Lskj.AutoCreatWord } foreach (TableRow tableRow in deleteRows) { + int index = tableRow.GetRowIndex(); + if (table.Rows.Count > index + 1) + { + TableRow nextTableRow = table.Rows[index + 1]; + foreach (TableCell tableCell in tableRow.Cells) + { + if (tableCell.CellFormat.VerticalMerge == CellMerge.Start) + { + List cloneParagraphs = new List(); + foreach (Paragraph paragraphItem in tableCell.Paragraphs) + { + Paragraph newParagraph = (Paragraph)paragraphItem.Clone(); + cloneParagraphs.Add(newParagraph); + } + tableCell.CellFormat.VerticalMerge = CellMerge.None; + TableCell nextCell = nextTableRow.Cells[tableCell.GetCellIndex()]; + nextCell.CellFormat.VerticalMerge = CellMerge.Start; + nextCell.Paragraphs.Clear(); + foreach (Paragraph paragraphItem in cloneParagraphs) + { + nextCell.Paragraphs.Add(paragraphItem); + } + } + } + } table.Rows.Remove(tableRow); } } @@ -1660,29 +1685,4 @@ namespace Lskj.AutoCreatWord /// /// /// - /// - private static void ReplaceTextRange(this Document document, string searchText, string replaceText, bool caseSensitive, bool wholeWord) - { - // 查找所有匹配 - TextSelection[] results = document.FindAllString(searchText, caseSensitive, wholeWord); - foreach (TextSelection selection in results) - { - TextRange textRange = selection.GetAsOneRange(); - if (textRange != null) - { - textRange.Text = Regex.Replace(textRange.Text, Regex.Escape(searchText), replaceText, RegexOptions.IgnoreCase); - } - } - } - /// - ///word表格数据配置的集合 - /// - protected class GridTarGet - { - public string number; - public Section targetSection; - public Table targetTable; - public int rowIndex; - } - } -} + \ No newline at end of file