Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Can we subclass word.application?
Message
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Titre:
Can we subclass word.application?
Divers
Thread ID:
00144385
Message ID:
00144385
Vues:
59
Now that I've worked a little with oWord = createobject( "word.application" ) I'd like to add some methods to it to make life easier. Like add an EraseDocument() which would just do the couple of lines of VBA calls that it takes.

What I've done so far is create a subclass WordHelper based on my cObject(Line) subclass that instantiates word and gets created like:
local loWord
this.moWordHelper = createobject( "WordHelper", @loWord )

if ( ! IsObject( this.moWordHelper ) )
   * it already complained about Word not found so just quit
   return .f.
endif

this.moWord = loWord
This kind of gives a dual interface you can talk to the word object directly using this.moWord (or this.moWordHelper.moWord but I don't like typing that much *s*) or to the Helper functionality using this.moWordHelper.EraseDocument() but I'm not sure I'm totally pleased with this and looking for suggestions. I don't really want to completely wrap moWord that's just too daunting dealing with all of it's interface methods and properties.
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform