procedure replacedoc(text, rtext: string);
var
FindText, MatchCase, MatchWholeWord, MatchWildcards, MatchSoundsLike,
MatchAllWordForms, Forward1, Wrap, Format, ReplaceWith, Replace, MatchKashida, MatchDiacritics,
MatchAlefHamza, MatchControl: OleVariant;
begin
FindText := text;
MatchCase := False;
MatchWholeWord := True;
MatchWildcards := False;
MatchSoundsLike := False;
MatchAllWordForms := False;
Forward1 := True;
Wrap := wdFindContinue;
Format := False;
ReplaceWith := rtext;
if replacewith = '' then
replacewith := '/';
Replace := True;
WordDocument.Range.Find.Execute(FindText, MatchCase, MatchWholeWord,
MatchWildcards, MatchSoundsLike, MatchAllWordForms, Forward1,
Wrap, Format, ReplaceWith, Replace, MatchKashida, MatchDiacritics,
MatchAlefHamza, MatchControl);end;
这是把一个值填充到word的指定字符处的过程,运行一切正常,但是碰到了这样一个问题,要替代的字符长度比较长,替代的时候就提示长度过长,不知道有什么参数限制字符长度的?
var
FindText, MatchCase, MatchWholeWord, MatchWildcards, MatchSoundsLike,
MatchAllWordForms, Forward1, Wrap, Format, ReplaceWith, Replace, MatchKashida, MatchDiacritics,
MatchAlefHamza, MatchControl: OleVariant;
begin
FindText := text;
MatchCase := False;
MatchWholeWord := True;
MatchWildcards := False;
MatchSoundsLike := False;
MatchAllWordForms := False;
Forward1 := True;
Wrap := wdFindContinue;
Format := False;
ReplaceWith := rtext;
if replacewith = '' then
replacewith := '/';
Replace := True;
WordDocument.Range.Find.Execute(FindText, MatchCase, MatchWholeWord,
MatchWildcards, MatchSoundsLike, MatchAllWordForms, Forward1,
Wrap, Format, ReplaceWith, Replace, MatchKashida, MatchDiacritics,
MatchAlefHamza, MatchControl);end;
这是把一个值填充到word的指定字符处的过程,运行一切正常,但是碰到了这样一个问题,要替代的字符长度比较长,替代的时候就提示长度过长,不知道有什么参数限制字符长度的?
Left(字符串, 500)