AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Sprachen und Entwicklungsumgebungen Sonstige Fragen zu Delphi Delphi Positionierung von Textbox in Worddokument über Delphi
Thema durchsuchen
Ansicht
Themen-Optionen

Positionierung von Textbox in Worddokument über Delphi

Ein Thema von luckystar85 · begonnen am 29. Jan 2011 · letzter Beitrag vom 30. Jan 2011
 
omata

Registriert seit: 26. Aug 2004
Ort: Nebel auf Amrum
3.154 Beiträge
 
Delphi 7 Enterprise
 
#7

AW: Positionierung von Textbox in Worddokument über Delphi

  Alt 30. Jan 2011, 20:08
Ich habe leider nur Office 2000 und Office 2007 zum testen. Aber folgendes bringt bei beiden Versionen das selbe Ergebnis:

Delphi-Quellcode:

uses WordXP;

procedure InsertWordTextBox(const AWordApplication : TWordApplication;
                            const ALeft, ATop, AWidth, AHeight : Double);
const
  msoTextOrientationHorizontal = 1;
  msoFalse = 0;
  msoLineSolid = 1;
  msoLineSingle = 1;
var
  lTextBox : OleVariant;
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;
end;

procedure TForm.ButtonClick(Sender: TObject);
var WordApplication:TWordApplication;
    Document:_Document;
begin
  WordApplication:=TWordApplication.Create(Self);
  try
    WordApplication.Connect;
    WordApplication.Visible:=true;
    Document:=WordApplication.Documents.Add(
      EmptyParam, EmptyParam, EmptyParam, EmptyParam
    );
    Document.ActiveWindow.ActivePane.View.SeekView := wdSeekCurrentPageHeader;
    InsertWordTextBox(WordApplication, 10, 10, 100, 100);
    WordApplication.Disconnect;
  finally
    WordApplication.free;
  end;
end;
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 00:58 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz