用Delphi把word中指定的字符串替换掉
比如word表式如下
。。地点:_____<#address#>_____(此处换行)
_______________________________________。1、用Delphi控制字符str写入word,把<#address#>替换掉,在第一行时没有存放得下,如何把str截掉多余的字符转到第二行?
2、如果第二行句号以前还不能完全写入str,如何通过字符缩放的方式使str在第二行上能够完全显示。
如果有高手觉得分太少,可以再放分。
谢谢
比如word表式如下
。。地点:_____<#address#>_____(此处换行)
_______________________________________。1、用Delphi控制字符str写入word,把<#address#>替换掉,在第一行时没有存放得下,如何把str截掉多余的字符转到第二行?
2、如果第二行句号以前还不能完全写入str,如何通过字符缩放的方式使str在第二行上能够完全显示。
如果有高手觉得分太少,可以再放分。
谢谢
Self.moFind.ClearFormatting;
Self.moFind.Text := sQueryInfo;
Self.moFind.Wrap := wdFindContinue;
Self.moFind.Forward := True;
Self.moFind.Replacement.ClearFormatting;
Self.moFind.Replacement.Font.Color := wdColorRed; if Self.moFind.Execute(Format:=True) then
begin
Self.moFind.Parent.Font.Color := wdColorRed;
end这是查找的代码,替换的改改就行
WordDocument1.ActiveWindow.Selection.Find.ClearFormatting;
if worddocument1.ActiveWindow.Selection.Find.Execute(FindText,MatchCase,MatchWholeWord,MatchWildcards,MatchSoundsLike,MatchAllWordForms,Forward,Wrap,Format, ReplaceWith,Replace,MatchKashida,MatchDiacritics,MatchAlefHamza,MatchControl) then
begin
WordDocument1.ActiveWindow.Selection.text:='sss';
//判断text 的长度 确定size 这个要自己试
WordDocument1.ActiveWindow.Selection.Font.Size:=9;
end;