Einzelnen Beitrag anzeigen

luckystar85

Registriert seit: 21. Dez 2004
Ort: Rostock
138 Beiträge
 
Delphi 2009 Professional
 
#6

AW: Positionierung von Textbox in Worddokument über Delphi

  Alt 29. Jan 2011, 20:05
sx2008, vielen Dank für den Hinweis. Ich habe meinen Code darauf hin angepasst, leider ohne Erfolg. Ich habe eben auch noch gesehen das die Umsetzung des Linienstils nicht funktioniert. Bei dem Textfeld unter 2003 ist noch der Rahmen sichtbar. Habe unter 2003 auch ein Makro aufgezeichnet zum Ausblenen des Rahmens. Habe das denn in Delphi nachgebaut und auch die Funktion läuft unter 2003 nicht. Bei Office 2010 wie gehabt ohne Probleme.

Delphi-Quellcode:
Procedure InsertWordTextBox(Const AWordApplication : TWordApplication; Const ALeft, ATop, AWidth, AHeight : Double);
Var
  lTextBox : Word_TLB.Shape;
Begin
  lTextBox := AWordApplication.Selection.HeaderFooter.Shapes.AddTextbox(msoTextOrientationHorizontal, ALeft, ATop, AWidth, AHeight, EmptyParam);
  lTextBox.Select(EmptyParam);
  lTextBox.TextFrame.TextRange.Select;
  lTextBox.Fill.Visible := msoFalse;
  lTextBox.Line.Visible := msoFalse;
  lTextBox.Line.Weight := 0.75;
  lTextBox.Line.DashStyle := msoLineSolid;
  lTextBox.Line.Style := msoLineSingle;
  lTextBox.Line.Transparency := 0;
  lTextBox.Line.Visible := msoFalse;
  lTextBox.LockAspectRatio := msoFalse;
  lTextBox.TextFrame.MarginLeft := 0;
  lTextBox.TextFrame.MarginRight := 0;
  lTextBox.TextFrame.MarginTop := 0;
  lTextBox.TextFrame.MarginBottom := 0;
  lTextBox.RelativeHorizontalPosition := wdRelativeHorizontalPositionPage;
  lTextBox.RelativeVerticalPosition := wdRelativeVerticalPositionPage;
  lTextBox.Left := ALeft;
  lTextBox.Top := ATop;
  lTextBox.WrapFormat.Side := wdWrapBoth;
  lTextBox.WrapFormat.DistanceTop := AWordApplication.CentimetersToPoints(0);
  lTextBox.WrapFormat.DistanceBottom := AWordApplication.CentimetersToPoints(0);
  lTextBox.WrapFormat.DistanceLeft := AWordApplication.CentimetersToPoints(0.32);
  lTextBox.WrapFormat.DistanceRight := AWordApplication.CentimetersToPoints(0.32);
  lTextBox.WrapFormat.type_ := 3;
  lTextBox.TextFrame.AutoSize := Integer(False);
  lTextBox.TextFrame.WordWrap := Integer(True);
End;
Miniaturansicht angehängter Grafiken
screenshot_2003.png   screenshot_2010.png  
Michael Klüber
Delphi ist was solides und besteht nicht wie C/C++ Quelltext nur aus Kommentaren.
  Mit Zitat antworten Zitat