📄 word97 hx.txt
字号:
History of TWord97 by Dr Allan Harkness A.Harkness@bio.gla.ac.uk
v1.0 16/2/99 - released to UNDU
v1.1 8/3/99 - bugs: -removed uDBG.pas from uses clause (debug unit not required)
v1.2 2/4/99 - bugs: -TWordApp.Destroy and TWordApp.FreeDocumentsAndSink had each other's
code (error pasting stuff around)
Thanks to Kees van Amerongen for spotting this
-function TWordDoc.GetActive; was wrongly implemented as a procedure
Thanks to Quamar Ali for spotting & fixing this
-Using $FF and $00 for True and False for e.g., Italics when I should
have used -1 and 0 - created two global constants (wdTrue and wdFalse)
to help keep this clear
Thanks to Jim Jackson for bringing this to my attention
- updates: -added extra error trapping to TWordRange.InsertGivenAutoText
-added boolean Sink argument to TWordApp.Create to allow creation of
WordApp without an event sink (as I don't use it)
-Made TWordApp.Create (UseExisting...) argument default to True
-Delphi 3 version created by Qamar Ali e-mail : MQamar@usa.net
v1.3 29/6/99 - uploaded to www.atheroma.freeserve.co.uk
- bugs: -TWordApp.CloseActiveDoc would cause an exception if there was no active
document. Amended procedure to catch this.
-Added a check for any active document in TWordEventSink.Invoke
before trying to connect to it. For some reason Word sends a CloseDoc and
then a ChangeDoc event when you close the last document. Since Borland's code
then tries to reconnect with the active document it gets an exception
as there is none! Borland just "threw away" the exception here but I think it
is neater to catch the error before it occurs (as it causes a break when
debugging in the IDE. NB the final "fault" lies with MS, whose event model
makes no sense (did they just throw in a few events at the last minute to show
it can be done?) I would strongly advise against relying on the event sink for
Word - but see my later implementation for some sense.
- updates: -added function TWordDoc.DocStillInWord : Boolean;
returns true if document still in Word. NB will return false
if a user has closed the document "behind your back". If you were to
then to use a method or property of that document, you would cause an
exception. NB it is unrealistic to check this before every use of a
TWordDoc object but I would recommend it if there may be a gap between
creating the document and the next use (eg in a btnCloseClick event
where the event would close the active document).
-Tidied TWordApp.RemoveDoc
-Tidied TWordDoc.CloseDoc
v1.4 13/7/99 - updates: -added complex sink events to TWordApp and integrated the sink better. TWordApp
will generate relatively helpful events (with the document object in the
parameters). Also tidied up a few bugs here and there.
-added TWordDoc.FullName property which contain the document's path and name (ie
same as Document.Fullname but will still exist if the COM object is closed.
-When TWordApp is created from an existing Word application it will import any
documents already present into the TWordApp.Documents list
- bugs: -added TWordDoc.Mode which indicates if the object is being created or destroyed.
this is mainly to stop events causing circular creates/frees.
v1.5 3/8/99 - updates: -added Bookmarking functions (inspired by work from Brett Parkhurst).
-added Word and page counting for TWordDoc and word counting for TWordRange.
-the above additions also apply to the Delphi 3 version. Tested Delphi 3 version using
the Delphi 3 copy of Word_TLB.
- bugs: -fixed (worked-around) a bug on closing Word. Sometimes an exception would occur as
the events were fired after FreeDocumentsAndSink. This didn't always happen in this
order (can't explain!) ? due to message queues. I'm not entirely happy with the fix
as it prevents events from firing in this case but I haven't tracked down why it only
happens sometimes. Help?
v1.6 22/8/99 - updates: -rewrote TWordApp.Create to get Application and Global object without relying on
exceptions when there is no active Word object. This should mean fewer breaks during
testing your programs. I never did like using an exception as part of "normal program
flow" and I am glad to have got rid of it. See comments in constructor for details and
possible caveats. NB I have changed the Delphi 3 version too - let me know if Delphi 3
does not support the method I have used and I will change it back.
-had a stab at trying to get Word object from TOleContainer but gave up. Anyone got this
working?
v1.7 4/10/99 - updates: -Delphi 5 compatible - had to change unit name as Delphi 5 imports the Word type library as
Word97.pas. Note my comments on the new Delphi server components in my FAQ. There are now a smattering of {$IFDEF}'s in the code and demo. The demo.dpr relies on the default location
for Delphi 4/5. Please amend the code as needed. Note that the Delphi 5 import routines
have changed the Application and other object names once again to WordApplication, etc.
This may affect your code (although this is by type assignment and the original names are
still there and will be type compatible).
-Managed to get TOleContainer to work. What a struggle! Wrote Demo2 to demonstrate it.
It is nothing fancy - no menu merging etc - but it works. Perhaps someone who is interested
in using TOleContainer could take it from here and make it more of a demo...
Note I have copied the Delphi 4/5 code for this to the Delphi 3 version (which has
also changed unit name) but I have not tested it as I don't have Delphi 3 installed.
Perhaps someone could let me know if it works...
Thanks to Hendrik Michaelis for some useful pointers with TOleContainer.
- bugs: -forgot to set FUsedExisting to true if I got an existing object - fixed.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -