![]() |
Problem mit S: Selection
Hallo kann mir einer sagen was das ist?
Delphi-Quellcode:
Ich habs von
var
S: Selection; // <-- Kennt mein Delphi net ... S :=Word.Selection; S.TypeText('Here is some text'); S.TypeParagraph; S.TypeParagraph; S.TypeText('And there was a blank line.'); ![]() |
Re: Problem mit S: Selection
Ich nehme an das dies ein Objekt aus Winword ist. Du hast wahrscheinlich die entsprechende Unit für Dein Office nicht eingebunden, daher kennt Delphi das nicht.
Gruß, Marcel |
Re: Problem mit S: Selection
So weit ich das verstehe hast du recht. :gruebel:
Ich hab es jetzt so gemacht: Weil S: Selection nicht geht und S dann einfach nur Word.Selction zugewiesen wird hab ich das S halt direct durch Word.Selection ersetzt. Ist ja auch logisch. :mrgreen: Aber ich kann das Word.Selection nicht mit "with" aufrufen. :cry:
Delphi-Quellcode:
mfg
with Word.Selection do begin // <-- Fehler: Record, object or class type required
TypeText('Hallo!'); end; freak |
Re: Problem mit S: Selection
Du kannst späte Bindung über die IDispatch Schnittstelle benützen:
Delphi-Quellcode:
Die With-Anweisung kann natürlich nicht funktionieren, da bei später Bindung der Delphi
var
S: OleVariant; // <===== ... S :=Word.Selection; S.TypeText('Here is some text'); S.TypeParagraph; S.TypeParagraph; S.TypeText('And there was a blank line.'); Kompiler keine Ahnung hat, was sich hinter OleVariant versteckt. Die Zeile
Code:
verursacht im Hintergrund folgendes:
S.TypeText('Here is some text');
* dein Programm fragt WinWord, nach der Nummer der Funktion TypeText * Word antwortet mit der Nummer der Funktion und den möglichen Parametern * dein Programm sendet die Nummer der Funktion + Parameter an Word * Word führt die Funktion aus und gibt evtl. einen Rückgabewert zurück |
Alle Zeitangaben in WEZ +1. Es ist jetzt 17: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