SVN r1041

SVN-Revision: r1041
This commit is contained in:
tdx
2025-11-18 06:34:16 +00:00
parent 631f22a4fa
commit f8b3d4a832
+26 -26
View File
@@ -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<Paragraph> cloneParagraphs = new List<Paragraph>();
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
/// </summary>
/// <param name="objects"></param>
/// <param name="searchText"></param>
/// <param name="replaceText"></param>
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);
}
}
}
/// <summary>
///word表格数据配置的集合
/// </summary>
protected class GridTarGet
{
public string number;
public Section targetSection;
public Table targetTable;
public int rowIndex;
}
}
}