Instead of Chr(13) & Chr(10), use Chr(11) or the constant wdVerticalTab:
activedocument.FormFields(1).Result = "a" & chr(11) & "b"
Hope this helps,
while (pos(#13#10, value) > 0) do
begin
value :=ReplaceString(value,#13#10, #11);
end;
WrdDoc.FormFields.Item(FieldName).Result := value;
function ReplaceString(Dest, SubStr, Str: string): string;
var
Position: Integer;
begin
Position:=Pos(SubStr, Dest);
Delete(Dest, Position, Length(SubStr));
Insert(Str, Dest, Position);
Result:=Dest;
end;
activedocument.FormFields(1).Result = "a" & chr(11) & "b"
Hope this helps,
while (pos(#13#10, value) > 0) do
begin
value :=ReplaceString(value,#13#10, #11);
end;
WrdDoc.FormFields.Item(FieldName).Result := value;
function ReplaceString(Dest, SubStr, Str: string): string;
var
Position: Integer;
begin
Position:=Pos(SubStr, Dest);
Delete(Dest, Position, Length(SubStr));
Insert(Str, Dest, Position);
Result:=Dest;
end;
Comments