Einzelnen Beitrag anzeigen

Benutzerbild von Harry M.
Harry M.

Registriert seit: 29. Okt 2004
Ort: Halle
462 Beiträge
 
#1

Zeilenumbruch in MS Word (Formularfeld)

  Alt 16. Jun 2008, 14:55
Hallo,
möchte gerne in MS word in ein Formularfeld einen Text hineinbringen. Soweit kein Problem. Text kommt auch an. Nur leider werden in dem Formularfeld keine Zeilenumbrüche dargestellt sondern der Text fortlaufend dargestellt, also hintereinander.

Delphi-Quellcode:
var
  Filename, vOle, Field: OleVariant;
  S: String;
  I: Integer;
begin
  FileName := ExtractFilePath(ParamStr(0)) + 'Dokument.doc';

  Self.WordApplication1.Connect;
  Self.WordApplication1.Visible := True;
  Self.WordApplication1.Documents.Open(FileName,
                                       EmptyParam,
                                       EmptyParam,
                                       EmptyParam,
                                       EmptyParam,
                                       EmptyParam,
                                       EmptyParam,
                                       EmptyParam,
                                       EmptyParam,
                                       EmptyParam,
                                       EmptyParam,
                                       EmptyParam,
                                       EmptyParam,
                                       EmptyParam,
                                       EmptyParam);

  vOle := 1;
  Field := 'input';

  for I := 1 to 10 do
    S := S + IntToStr(I) + #13#10;

  // Self.WordApplication1.Documents.Item(vOle).FormFields.Item(Field).Result := WideString(S);
  Self.WordApplication1.Documents.Item(vOle).FormFields.Item(Field). := S;

  Self.WordDocument1.Close;
  Self.WordApplication1.Disconnect;
end;
Jemand eine Idee wie ich dem Formularfeld den Zeilenumbruch erzwingen kann?
Ersatzweise würde ich auch dynamisch ein neues Feld einfügen. Es muss sich dann aber in der Folgezeile positionieren. Hab aber keine Idee.
Harry
Gruß Harry
www.H-Soft.info
  Mit Zitat antworten Zitat