SVN r939
SVN-Revision: r939
This commit is contained in:
@@ -1046,6 +1046,7 @@ namespace Lskj.AutoCreatWord
|
||||
{
|
||||
string columnName = columnNames[j];
|
||||
Paragraph cloneParagraph = (Paragraph)table.Rows[gridTar.rowIndex].Cells[j].Paragraphs[0].Clone();
|
||||
CharacterFormat characterFormat = (cloneParagraph.ChildObjects[0] as TextRange).CharacterFormat;
|
||||
ParagraphFormat paragraphFormat = newRow.Cells[j].Paragraphs[0].Format;
|
||||
newRow.Cells[j].Paragraphs.Clear();
|
||||
newRow.Cells[j].Paragraphs.Add(cloneParagraph);
|
||||
@@ -1067,7 +1068,8 @@ namespace Lskj.AutoCreatWord
|
||||
Break lineBreak = new Break(document, BreakType.LineBreak);
|
||||
cloneParagraph.ChildObjects.Add(lineBreak);
|
||||
}
|
||||
cloneParagraph.AppendText(resultText);
|
||||
TextRange textRange = cloneParagraph.AppendText(resultText);
|
||||
textRange.ApplyCharacterFormat(characterFormat);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1658,4 +1660,29 @@ 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user