Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Excel automation and procedures
Message
 
 
À
20/03/2018 16:28:10
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01658838
Message ID:
01658877
Vues:
50
>>>>>> Tamar, It was your book that allowed me to start automating excel. I am using different tabs and procedures because I use one procedure to, for instance, make one histogram showing numbers of A', the same procedure to make a pivot table, showing the # of A's per year, etc. What do you mean, where is it in your book, when you tablk about using a property of either a dedicated automation object or the application object. I missed this part, somehow. But your book is in front of me.
>>>>>>
>>>>>
>>>>>This paragraph is near the end of the Introduction:
>>>>>
>>>>>"For larger examples, we had to make a choice. In real applications, you almost always want to open the Automation server, do what needs to be done, and close the server. In that situation, you can use a local variable to hold the reference to the server. For our purposes, however, we usually want the server to stay open and accessible following the example so that you can examine the results and reference the server from the Command Window. However, we didn’t want to leave multiple instances of the servers running, abandoned and using your system resources. So most of the examples that are included in the Developer Downloads clear any variables that might be references to Automation objects, and then create a public variable to reference the server. We do not recommend using this technique in your applications."
>>>>>
>>>>>And most of the examples that declare a public variable, include a comment about it being for demo purposes. In addition, Chapter 15 talks about building a class to wrap the servers and shows how to set up the reference in a property.
>>>>>
>>>>>Tamar
>>>>
>>>>I was just working on an application with automation functionality, and we have quite some performance issues, especially when closing the Word server it sometimes takes up to 10 seconds to finalize the quit command. Therefore I am now thinking to change it so the application instantiates the server at the first access and then keeps reusing the server until the application closes and then we can force a task kill. What do you think about this approach, since I just read you would rather open and close the server at demand. What it does now in our application, it processes several Word documents and with each document it instantiates and closes the Word server.
>>>>
>>>>BTW, the slow closing happens only on some machines, and only if there is no internet connect. I could not find any specific reason for that. The only cure might be re-installing Office and/or Windows, but that same problem could of course occur at a client, so that would not really be a solution we could offer.
>>>
>>>You shouldn't need to task kill Word, it will "kill itself" when there's no more reference to it, IOW when your application exits.
>>
>>that I cannot reproduce. If I instantiate the object, and close VFP, the Winword process stays there until I kill the task in the task manager.
>
>It turns out that you are right, much to my surprise. I am not sure, but I don't think that was the case with older Word versions. I checked Excel, and is released automatically.

Now I am surprised as well, because I thought Excel behaves the same as Word, but you are right, it releases the process when the reference is cleared. Good to know, at least I don't need to worry for closing Excel.
Christian Isberner
Software Consultant
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform